@@ -22,6 +22,7 @@ func TestConditionWithContextFunc_GetFails(t *testing.T) {
22
22
g := NewWithT (t )
23
23
fakeStatusUpdater := & statusfakes.FakeStatusUpdater {}
24
24
fakeGetter := & controllerfakes.FakeGetter {}
25
+
25
26
fakeGetter .GetReturns (errors .New ("failed to get resource" ))
26
27
f := status .ConditionWithContextFunc (
27
28
fakeGetter ,
@@ -31,6 +32,7 @@ func TestConditionWithContextFunc_GetFails(t *testing.T) {
31
32
logr .New (nil ),
32
33
func (client.Object ) {})
33
34
boolean , err := f (context .Background ())
35
+
34
36
g .Expect (err ).ToNot (HaveOccurred ())
35
37
g .Expect (boolean ).To (BeFalse ())
36
38
}
@@ -39,6 +41,7 @@ func TestConditionWithContextFunc_GetFailsIsNotFound(t *testing.T) {
39
41
g := NewWithT (t )
40
42
fakeStatusUpdater := & statusfakes.FakeStatusUpdater {}
41
43
fakeGetter := & controllerfakes.FakeGetter {}
44
+
42
45
fakeGetter .GetReturns (apierrors .NewNotFound (schema.GroupResource {}, "not found" ))
43
46
f := status .ConditionWithContextFunc (
44
47
fakeGetter ,
@@ -48,6 +51,7 @@ func TestConditionWithContextFunc_GetFailsIsNotFound(t *testing.T) {
48
51
logr .New (nil ),
49
52
func (client.Object ) {})
50
53
boolean , err := f (context .Background ())
54
+
51
55
g .Expect (err ).ToNot (HaveOccurred ())
52
56
g .Expect (boolean ).To (BeTrue ())
53
57
}
@@ -56,6 +60,7 @@ func TestConditionWithContextFunc_UpdateFails(t *testing.T) {
56
60
g := NewWithT (t )
57
61
fakeStatusUpdater := & statusfakes.FakeStatusUpdater {}
58
62
fakeGetter := & controllerfakes.FakeGetter {}
63
+
59
64
fakeStatusUpdater .UpdateReturns (errors .New ("failed to update resource" ))
60
65
f := status .ConditionWithContextFunc (
61
66
fakeGetter ,
@@ -65,6 +70,7 @@ func TestConditionWithContextFunc_UpdateFails(t *testing.T) {
65
70
logr .New (nil ),
66
71
func (client.Object ) {})
67
72
boolean , err := f (context .Background ())
73
+
68
74
g .Expect (err ).ToNot (HaveOccurred ())
69
75
g .Expect (boolean ).To (BeFalse ())
70
76
}
@@ -73,6 +79,7 @@ func TestConditionWithContextFunc_NothingFails(t *testing.T) {
73
79
g := NewWithT (t )
74
80
fakeStatusUpdater := & statusfakes.FakeStatusUpdater {}
75
81
fakeGetter := & controllerfakes.FakeGetter {}
82
+
76
83
f := status .ConditionWithContextFunc (
77
84
fakeGetter ,
78
85
fakeStatusUpdater ,
@@ -81,6 +88,7 @@ func TestConditionWithContextFunc_NothingFails(t *testing.T) {
81
88
logr .New (nil ),
82
89
func (client.Object ) {})
83
90
boolean , err := f (context .Background ())
91
+
84
92
g .Expect (err ).ToNot (HaveOccurred ())
85
93
g .Expect (boolean ).To (BeTrue ())
86
94
}
0 commit comments