-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuite_test.go
More file actions
52 lines (48 loc) · 1.12 KB
/
Copy pathsuite_test.go
File metadata and controls
52 lines (48 loc) · 1.12 KB
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
package testrunner
import "testing"
func TestParseSuite_Valid(t *testing.T) {
yaml := `
name: test-suite
topology:
nodes:
m01: {host: 192.168.1.1, user: test, key: /tmp/key}
deploy:
kill_ports: [9433]
binaries:
- local: weed-linux
remote: /opt/weed
scenarios:
- path: scenarios/test.yaml
id: T1
evidence:
save_to: results/test
`
suite, err := ParseSuite([]byte(yaml))
if err != nil {
t.Fatal(err)
}
if suite.Name != "test-suite" {
t.Fatalf("name=%q", suite.Name)
}
if len(suite.Scenarios) != 1 {
t.Fatalf("scenarios=%d", len(suite.Scenarios))
}
if suite.Scenarios[0].ID != "T1" {
t.Fatalf("id=%q", suite.Scenarios[0].ID)
}
if len(suite.Deploy.KillPorts) != 1 || suite.Deploy.KillPorts[0] != 9433 {
t.Fatalf("kill_ports=%v", suite.Deploy.KillPorts)
}
}
func TestParseSuite_MissingName(t *testing.T) {
_, err := ParseSuite([]byte(`scenarios: [{path: x.yaml}]`))
if err == nil {
t.Fatal("expected error for missing name")
}
}
func TestParseSuite_NoScenarios(t *testing.T) {
_, err := ParseSuite([]byte(`name: empty`))
if err == nil {
t.Fatal("expected error for no scenarios")
}
}