/
output-steps.go
68 lines (49 loc) · 1.57 KB
/
output-steps.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package steps
import (
"fmt"
"strings"
"github.com/ess/jamaica"
"github.com/ess/kennel"
)
type OutputSteps struct{}
func (steps *OutputSteps) StepUp(s kennel.Suite) {
s.Step(`^I see an error about the group's missing scaling script$`, func() error {
output := fmt.Sprintf("%s", jamaica.LastCommandStatus())
if !strings.Contains(output, "mygroup requires a scaling_script") {
return fmt.Errorf("Didn't see a scaling script error")
}
return nil
})
s.Step(`^I see an error about the non-existent scaling script$`, func() error {
output := fmt.Sprintf("%s", jamaica.LastCommandStatus())
if !strings.Contains(output, "mygroup scaling_script does not exist on the file system") {
return fmt.Errorf("Didn't see a scaling script error")
}
return nil
})
s.Step(`^I see an error about the missing scaling servers$`, func() error {
output := fmt.Sprintf("%s", jamaica.LastCommandStatus())
if !strings.Contains(output, "mygroup contains no scaling servers") {
return fmt.Errorf("Didn't see a scaling server error")
}
return nil
})
s.Step(`^I see an error about the invalid scaling server$`, func() error {
output := fmt.Sprintf("%s", jamaica.LastCommandStatus())
if !strings.Contains(output, "mygroup contains invalid scaling server") {
return fmt.Errorf("Didn't see a scaling server error")
}
return nil
})
s.Step(`^the tests print the output$`, func() error {
fmt.Printf(
"output: %s\nerror: %s\n",
jamaica.LastCommandStdout(),
jamaica.LastCommandStatus(),
)
return nil
})
}
func init() {
kennel.Register(new(OutputSteps))
}