Skip to content

Commit b0fe276

Browse files
committed
tests(integration): document regression test for clusters:update --auth=
We already had a regression test to ensure the deis CLI wasn't just sending the key path when updating the cluster. This change makes that clearer and clarifies the output of the `CheckList()` test function.
1 parent 31e9f36 commit b0fe276

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package tests
44

55
import (
6-
_ "fmt"
76
"testing"
87

98
"github.com/deis/deis/tests/integration-utils"
@@ -33,11 +32,11 @@ func clustersInfoTest(t *testing.T, params *itutils.DeisTestConfig) {
3332
itutils.Execute(t, cmd, params, false, "")
3433
}
3534

36-
//Tets #1283
37-
3835
func clustersUpdateTest(t *testing.T, params *itutils.DeisTestConfig) {
3936
cmd := itutils.GetCommand("clusters", "update")
40-
itutils.CheckList(t, params, cmd, "~/.ssh/"+params.AuthKey, true)
37+
// Regression test for https://github.com/deis/deis/pull/1283
38+
// Check that we didn't store the path of the key in the cluster.
39+
itutils.CheckList(t, params, cmd, "~/.ssh/", true)
4140
}
4241

4342
func clustersDestroyTest(t *testing.T, params *itutils.DeisTestConfig) {

tests/integration-utils/itutils.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ func AuthCancel(t *testing.T, params *DeisTestConfig) {
133133

134134
}
135135

136-
// CheckList executes a command and optionally tests whether its output contains
137-
// a given string.
138-
func CheckList(t *testing.T, params interface{}, cmd, contain string, notflag bool) {
136+
// CheckList executes a command and optionally tests whether its output does
137+
// or does not contain a given string.
138+
func CheckList(
139+
t *testing.T, params interface{}, cmd, contain string, notflag bool) {
139140
var cmdBuf bytes.Buffer
140141
tmpl := template.Must(template.New("cmd").Parse(cmd))
141142
if err := tmpl.Execute(&cmdBuf, params); err != nil {
@@ -149,13 +150,17 @@ func CheckList(t *testing.T, params interface{}, cmd, contain string, notflag bo
149150
} else {
150151
cmdl = exec.Command("sh", "-c", Deis+cmdString)
151152
}
152-
if stdout, _, err := utils.RunCommandWithStdoutStderr(cmdl); err == nil {
153-
if strings.Contains(stdout.String(), contain) == notflag {
154-
t.Fatal(err)
155-
}
156-
} else {
153+
stdout, _, err := utils.RunCommandWithStdoutStderr(cmdl)
154+
if err != nil {
157155
t.Fatal(err)
158156
}
157+
if strings.Contains(stdout.String(), contain) == notflag {
158+
if notflag {
159+
t.Fatalf(
160+
"Didn't expect '%s' in command output:\n%s", contain, stdout)
161+
}
162+
t.Fatalf("Expected '%s' in command output:\n%s", contain, stdout)
163+
}
159164
}
160165

161166
// Execute takes command string and parameters required to execute the command,

0 commit comments

Comments
 (0)