forked from nginx/nginx-gateway-fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconditions_test.go
61 lines (55 loc) · 977 Bytes
/
conditions_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
package conditions
import (
"testing"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func TestDeduplicateConditions(t *testing.T) {
g := NewWithT(t)
conds := []Condition{
{
Type: "Type1",
Status: metav1.ConditionTrue,
Message: "0",
},
{
Type: "Type1",
Status: metav1.ConditionFalse,
Message: "1",
},
{
Type: "Type2",
Status: metav1.ConditionFalse,
Message: "2",
},
{
Type: "Type2",
Status: metav1.ConditionTrue,
Message: "3",
},
{
Type: "Type3",
Status: metav1.ConditionTrue,
Message: "4",
},
}
expected := []Condition{
{
Type: "Type1",
Status: metav1.ConditionFalse,
Message: "1",
},
{
Type: "Type2",
Status: metav1.ConditionTrue,
Message: "3",
},
{
Type: "Type3",
Status: metav1.ConditionTrue,
Message: "4",
},
}
result := DeduplicateConditions(conds)
g.Expect(result).Should(Equal(expected))
}