Skip to content

Commit 821a698

Browse files
committed
Add system test
1 parent 2fe7e0b commit 821a698

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

src/e2e/system_test.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package e2e
2+
3+
import (
4+
"strings"
5+
"testing"
6+
)
7+
8+
func TestSystemHappyPath(t *testing.T) {
9+
tc := CLITest{
10+
Steps: []Step{
11+
Create{
12+
Cmd: "create system",
13+
Input: `
14+
name: "Integration Test System"
15+
description: "Created by integration test"
16+
`,
17+
},
18+
Get{
19+
Cmd: "get system",
20+
Validate: func(u *Utility, out string) {
21+
if !strings.Contains(out, "Integration Test System") {
22+
u.Fatalf("get after create failed: %s", out)
23+
}
24+
},
25+
},
26+
List{
27+
Cmd: "list system",
28+
Validate: func(u *Utility, out string) {
29+
if !strings.Contains(out, "Integration Test System") {
30+
u.Fatalf("list missing system: %s", out)
31+
}
32+
},
33+
},
34+
Update{
35+
Cmd: "update system",
36+
Input: `
37+
name: "Integration Test System Updated"
38+
description: "Updated by integration test"
39+
`,
40+
},
41+
Get{
42+
Cmd: "get system",
43+
Validate: func(u *Utility, out string) {
44+
if !strings.Contains(out, "Integration Test System Updated") || !strings.Contains(out, "Updated by integration test") {
45+
u.Fatalf("update1 failed\nout: %s", out)
46+
}
47+
},
48+
},
49+
// TODO: description cannot be unset yet
50+
// Update{
51+
// Cmd: "update system",
52+
// Input: `
53+
//name: "Integration Test System Updated Again"
54+
//description: null
55+
//`,
56+
// },
57+
// Get{
58+
// Cmd: "get system",
59+
// Validate: func(u *Utility, out string) {
60+
// if !strings.Contains(out, "Integration Test System Updated Again") || strings.Contains(out, "Updated by integration test") {
61+
// u.Fatalf("update2 failed (description should be unset)\nout: %s", out)
62+
// }
63+
// },
64+
// },
65+
Delete{
66+
Cmd: "delete system",
67+
},
68+
Missing{
69+
Cmd: "get system",
70+
},
71+
},
72+
}
73+
tc.Run(t)
74+
}

0 commit comments

Comments
 (0)