Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/config/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestConfigGetCmd_PartialKey(t *testing.T) {

// Test Config Get Command fails when provided an invalid key
func TestConfigGetCmd_InvalidKey(t *testing.T) {
expectedErrorPattern := `^failed to get configuration: key '.*' is not recognized as a valid configuration key\. Valid keys: [A-Za-z\.\s,]+$`
expectedErrorPattern := `(?s)^failed to get configuration: key '.*' is not recognized as a valid configuration key\. Valid keys: .*$`
err := testutils_cobra.ExecutePingcli(t, "config", "get", "pingcli.invalid")
testutils.CheckExpectedError(t, err, &expectedErrorPattern)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/config/get_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func Test_RunInternalConfigGet(t *testing.T) {
func Test_RunInternalConfigGet_InvalidKey(t *testing.T) {
testutils_viper.InitVipers(t)

expectedErrorPattern := `^failed to get configuration: key '.*' is not recognized as a valid configuration key. Valid keys: .*$`
expectedErrorPattern := `(?s)^failed to get configuration: key '.*' is not recognized as a valid configuration key. Valid keys: .*$`
err := RunInternalConfigGet("invalid-key")
testutils.CheckExpectedError(t, err, &expectedErrorPattern)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ func ExpandedViperKeys() (keys []string) {
func ValidateParentViperKey(viperKey string) error {
validKeys := ExpandedViperKeys()
for _, vKey := range validKeys {
if vKey == viperKey {
if strings.EqualFold(vKey, viperKey) {
return nil
}
}

validKeysStr := strings.Join(validKeys, ", ")
validKeysStr := "\n- " + strings.Join(validKeys, "\n- ")
return fmt.Errorf("key '%s' is not recognized as a valid configuration key. Valid keys: %s", viperKey, validKeysStr)
}

Expand Down
4 changes: 2 additions & 2 deletions internal/configuration/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func Test_ValidateParentViperKey(t *testing.T) {
func Test_ValidateParentViperKey_InvalidKey(t *testing.T) {
testutils_viper.InitVipers(t)

expectedErrorPattern := `^key '.*' is not recognized as a valid configuration key. Valid keys: .*$`
expectedErrorPattern := `(?s)^key '.*' is not recognized as a valid configuration key. Valid keys: .*$`
err := configuration.ValidateParentViperKey("invalid-key")
testutils.CheckExpectedError(t, err, &expectedErrorPattern)
}
Expand All @@ -59,7 +59,7 @@ func Test_ValidateParentViperKey_InvalidKey(t *testing.T) {
func Test_ValidateParentViperKey_EmptyKey(t *testing.T) {
testutils_viper.InitVipers(t)

expectedErrorPattern := `^key '' is not recognized as a valid configuration key. Valid keys: .*$`
expectedErrorPattern := `(?s)^key '' is not recognized as a valid configuration key. Valid keys: .*$`
err := configuration.ValidateParentViperKey("")
testutils.CheckExpectedError(t, err, &expectedErrorPattern)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func SetColorize() {
func Message(message string, fields map[string]interface{}) {
l := logger.Get()

print(fmt.Sprintf("INFO: %s", message), fields, white, l.Info)
print(message, fields, white, l.Info)
}

// This function outputs green text to inform the user of success
Expand Down