diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-09-28 15:17:50 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-09-29 10:27:39 +0200 |
commit | 16977143c48117d254c548e7f94968976f54a72c (patch) | |
tree | 09d044ebd82090bc2fc391afbe5c062dca3b37e5 /client/go/cmd/config_test.go | |
parent | 728dfbe2c8dc0b387b5e6671ff0fe4e4cfbed2f8 (diff) |
Print errors to stderr
Diffstat (limited to 'client/go/cmd/config_test.go')
-rw-r--r-- | client/go/cmd/config_test.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/client/go/cmd/config_test.go b/client/go/cmd/config_test.go index 223c8a396c3..7f7bdbb3edd 100644 --- a/client/go/cmd/config_test.go +++ b/client/go/cmd/config_test.go @@ -10,7 +10,7 @@ import ( func TestConfig(t *testing.T) { homeDir := filepath.Join(t.TempDir(), ".vespa") - assertConfigCommand(t, "invalid option or value: \"foo\": \"bar\"\n", homeDir, "config", "set", "foo", "bar") + assertConfigCommandErr(t, "invalid option or value: \"foo\": \"bar\"\n", homeDir, "config", "set", "foo", "bar") assertConfigCommand(t, "foo = <unset>\n", homeDir, "config", "get", "foo") assertConfigCommand(t, "target = local\n", homeDir, "config", "get", "target") assertConfigCommand(t, "", homeDir, "config", "set", "target", "cloud") @@ -19,7 +19,7 @@ func TestConfig(t *testing.T) { assertConfigCommand(t, "", homeDir, "config", "set", "target", "https://127.0.0.1") assertConfigCommand(t, "target = https://127.0.0.1\n", homeDir, "config", "get", "target") - assertConfigCommand(t, "invalid application: \"foo\"\n", homeDir, "config", "set", "application", "foo") + assertConfigCommandErr(t, "invalid application: \"foo\"\n", homeDir, "config", "set", "application", "foo") assertConfigCommand(t, "application = <unset>\n", homeDir, "config", "get", "application") assertConfigCommand(t, "", homeDir, "config", "set", "application", "t1.a1.i1") assertConfigCommand(t, "application = t1.a1.i1\n", homeDir, "config", "get", "application") @@ -27,7 +27,7 @@ func TestConfig(t *testing.T) { assertConfigCommand(t, "application = t1.a1.i1\ncolor = auto\ntarget = https://127.0.0.1\nwait = 0\n", homeDir, "config", "get") assertConfigCommand(t, "", homeDir, "config", "set", "wait", "60") - assertConfigCommand(t, "wait option must be an integer >= 0, got \"foo\"\n", homeDir, "config", "set", "wait", "foo") + assertConfigCommandErr(t, "wait option must be an integer >= 0, got \"foo\"\n", homeDir, "config", "set", "wait", "foo") assertConfigCommand(t, "wait = 60\n", homeDir, "config", "get", "wait") } @@ -35,3 +35,8 @@ func assertConfigCommand(t *testing.T, expected, homeDir string, args ...string) out, _ := execute(command{homeDir: homeDir, args: args}, t, nil) assert.Equal(t, expected, out) } + +func assertConfigCommandErr(t *testing.T, expected, homeDir string, args ...string) { + _, outErr := execute(command{homeDir: homeDir, args: args}, t, nil) + assert.Equal(t, expected, outErr) +} |