@@ -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