-
Notifications
You must be signed in to change notification settings - Fork 11
/
environment_test.go
80 lines (68 loc) · 3.14 KB
/
environment_test.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
69
70
71
72
73
74
75
76
77
78
79
80
package test
func (s *CLITestSuite) TestEnvironment() {
tests := []CLITest{
{args: "environment list", fixture: "environment/1.golden", login: "cloud"},
{args: "environment use env-595", fixture: "environment/2.golden"},
{args: "environment update env-595 --name new-other-name --governance-package advanced", fixture: "environment/3.golden"},
{args: "environment list", fixture: "environment/4.golden"},
{args: "environment list -o json", fixture: "environment/5.golden"},
{args: "environment list -o yaml", fixture: "environment/6.golden"},
{args: "environment use env-dne", fixture: "environment/7.golden", exitCode: 1},
{args: "environment create saucayyy", fixture: "environment/8.golden"},
{args: "environment create saucayyy -o json --governance-package advanced", fixture: "environment/9.golden"},
{args: "environment create saucayyy -o yaml", fixture: "environment/10.golden"},
}
resetConfiguration(s.T(), false)
for _, test := range tests {
test.workflow = true
s.runIntegrationTest(test)
}
}
func (s *CLITestSuite) TestEnvironmentDescribe() {
tests := []CLITest{
{args: "environment describe env-123456", fixture: "environment/describe.golden"},
{args: "environment describe env-123456 -o json", fixture: "environment/describe-json.golden"},
}
for _, test := range tests {
test.login = "cloud"
s.runIntegrationTest(test)
}
}
func (s *CLITestSuite) TestEnvironmentDelete() {
tests := []CLITest{
{args: "environment delete env-595 --force", fixture: "environment/delete/success.golden"},
{args: "environment delete env-595", input: "y\n", fixture: "environment/delete/success-prompt.golden"},
{args: "environment delete env-dne", fixture: "environment/delete/fail.golden", exitCode: 1},
{args: "environment delete env-srUpdate env-dne", fixture: "environment/delete/multiple-fail.golden", exitCode: 1},
{args: "environment delete env-srUpdate env-595", input: "n\n", fixture: "environment/delete/multiple-refuse.golden"},
{args: "environment delete env-srUpdate env-595", input: "y\n", fixture: "environment/delete/multiple-success.golden"},
{args: "environment delete env-595 env-srUpdate env-000 env-111", input: "y\n", fixture: "environment/delete/multierror.golden", exitCode: 1},
}
for _, test := range tests {
test.login = "cloud"
s.runIntegrationTest(test)
}
}
func (s *CLITestSuite) TestEnvironmentUse() {
tests := []CLITest{
{args: "environment use env-123456", fixture: "environment/use.golden"},
{args: "environment describe", fixture: "environment/describe-after-use.golden"},
}
for _, test := range tests {
test.login = "cloud"
s.runIntegrationTest(test)
}
}
func (s *CLITestSuite) TestEnvironmentUpdate_PackageDowngrade() {
tests := []CLITest{
{args: "environment update env-595 --governance-package essentials", fixture: "environment/update-governance-package-downgrade-fail.golden", exitCode: 1},
}
for _, test := range tests {
test.workflow = true
s.runIntegrationTest(test)
}
}
func (s *CLITestSuite) TestEnvironment_Autocomplete() {
test := CLITest{args: `__complete environment describe ""`, login: "cloud", fixture: "environment/describe-autocomplete.golden"}
s.runIntegrationTest(test)
}