-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchaos_test.go
51 lines (46 loc) · 1021 Bytes
/
chaos_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
// Copyright 2020 Justice Nanhou. All rights reserved.
// license that can be found in the LICENSE file.
package chaos
import (
"testing"
)
func TestRegisterAgent(t *testing.T) {
type args struct {
a *Agent
}
tests := []struct {
name string
args args
want int
}{
{"adding agent", args{&Agent{Name: "agent1", Setup: nil}}, 1},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
RegisterAgent(tt.args.a)
if got := GetAgentStoreInstance().Count(); got != tt.want {
t.Errorf("RegisterAgent(..) saved = %v, want %v", got, tt.want)
}
})
}
}
func Test_genID(t *testing.T) {
tests := []struct {
name string
want string
}{
{"call genID", genID()},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := genID(); got == tt.want {
t.Errorf("genID() = %v, want %v", got, tt.want)
lenGot := len(got)
lenWant := len(tt.want)
if lenGot != lenWant {
t.Errorf("len of = %v, and %v missmatch", got, tt.want)
}
}
})
}
}