-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigdiff_test.go
More file actions
48 lines (43 loc) · 1.09 KB
/
configdiff_test.go
File metadata and controls
48 lines (43 loc) · 1.09 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
package configdiff
import "testing"
func TestChangeTypeString(t *testing.T) {
tests := []struct {
ct ChangeType
want string
}{
{ChangeTypeAdd, "add"},
{ChangeTypeRemove, "remove"},
{ChangeTypeModify, "modify"},
{ChangeTypeMove, "move"},
}
for _, tt := range tests {
t.Run(string(tt.ct), func(t *testing.T) {
if got := string(tt.ct); got != tt.want {
t.Errorf("ChangeType = %v, want %v", got, tt.want)
}
})
}
}
func TestOptions(t *testing.T) {
opts := Options{
IgnorePaths: []string{"metadata.timestamp"},
ArraySetKeys: map[string]string{"spec.containers": "name"},
Coercions: Coercions{
NumericStrings: true,
BoolStrings: true,
},
StableOrder: true,
}
if len(opts.IgnorePaths) != 1 {
t.Errorf("IgnorePaths len = %v, want 1", len(opts.IgnorePaths))
}
if opts.ArraySetKeys["spec.containers"] != "name" {
t.Errorf("ArraySetKeys = %v, want 'name'", opts.ArraySetKeys["spec.containers"])
}
if !opts.Coercions.NumericStrings {
t.Error("NumericStrings = false, want true")
}
if !opts.StableOrder {
t.Error("StableOrder = false, want true")
}
}