@@ -78,13 +78,13 @@ func TestPoolDeletionWithExistingIPAddresses(t *testing.T) {
78
78
Client : fakeClient ,
79
79
}
80
80
81
- g .Expect (webhook .ValidateDelete (ctx , namespacedPool )).Error ().NotTo ( BeNil (), "should not allow deletion when claims exist" )
82
- g .Expect (webhook .ValidateDelete (ctx , globalPool )).Error ().NotTo ( BeNil (), "should not allow deletion when claims exist" )
81
+ g .Expect (webhook .ValidateDelete (ctx , namespacedPool )).Error ().To ( HaveOccurred (), "should not allow deletion when claims exist" )
82
+ g .Expect (webhook .ValidateDelete (ctx , globalPool )).Error ().To ( HaveOccurred (), "should not allow deletion when claims exist" )
83
83
84
84
g .Expect (fakeClient .DeleteAllOf (ctx , & ipamv1.IPAddress {})).To (Succeed ())
85
85
86
- g .Expect (webhook .ValidateDelete (ctx , namespacedPool )).Error ().To ( BeNil (), "should allow deletion when no claims exist" )
87
- g .Expect (webhook .ValidateDelete (ctx , globalPool )).Error ().To ( BeNil (), "should allow deletion when no claims exist" )
86
+ g .Expect (webhook .ValidateDelete (ctx , namespacedPool )).Error ().NotTo ( HaveOccurred (), "should allow deletion when no claims exist" )
87
+ g .Expect (webhook .ValidateDelete (ctx , globalPool )).Error ().NotTo ( HaveOccurred (), "should allow deletion when no claims exist" )
88
88
}
89
89
90
90
func TestUpdatingPoolInUseAddresses (t * testing.T ) {
@@ -135,8 +135,8 @@ func TestUpdatingPoolInUseAddresses(t *testing.T) {
135
135
namespacedPool .Spec .Addresses = []string {"10.0.0.15-10.0.0.20" }
136
136
globalPool .Spec .Addresses = []string {"10.0.0.15-10.0.0.20" }
137
137
138
- g .Expect (webhook .ValidateUpdate (ctx , oldNamespacedPool , namespacedPool )).Error ().NotTo ( BeNil (), "should not allow removing in use IPs from addresses field in pool" )
139
- g .Expect (webhook .ValidateUpdate (ctx , oldGlobalPool , globalPool )).Error ().NotTo ( BeNil (), "should not allow removing in use IPs from addresses field in pool" )
138
+ g .Expect (webhook .ValidateUpdate (ctx , oldNamespacedPool , namespacedPool )).Error ().To ( HaveOccurred (), "should not allow removing in use IPs from addresses field in pool" )
139
+ g .Expect (webhook .ValidateUpdate (ctx , oldGlobalPool , globalPool )).Error ().To ( HaveOccurred (), "should not allow removing in use IPs from addresses field in pool" )
140
140
}
141
141
142
142
func TestDeleteSkip (t * testing.T ) {
@@ -188,8 +188,8 @@ func TestDeleteSkip(t *testing.T) {
188
188
Client : fakeClient ,
189
189
}
190
190
191
- g .Expect (webhook .ValidateDelete (ctx , namespacedPool )).Error ().To ( BeNil ())
192
- g .Expect (webhook .ValidateDelete (ctx , globalPool )).Error ().To ( BeNil ())
191
+ g .Expect (webhook .ValidateDelete (ctx , namespacedPool )).Error ().NotTo ( HaveOccurred ())
192
+ g .Expect (webhook .ValidateDelete (ctx , globalPool )).Error ().NotTo ( HaveOccurred ())
193
193
}
194
194
195
195
func TestInClusterIPPoolDefaulting (t * testing.T ) {
@@ -701,9 +701,9 @@ func TestIPPool_Prefix(t *testing.T) {
701
701
Client : fakeClient ,
702
702
}
703
703
704
- g .Expect (webhook .validate (& v1alpha2.InClusterIPPool {}, namespacedPool )).Error ().To ( BeNil (), "should allow /0 prefix InClusterIPPool" )
705
- g .Expect (webhook .validate (& v1alpha2.GlobalInClusterIPPool {}, globalPool )).Error ().To ( BeNil (), "should allow /0 prefix GlobalInClusterIPPool" )
706
- g .Expect (webhook .validate (& v1alpha2.InClusterIPPool {}, emptyPrefixPool )).Error ().To ( BeNil (), "should allow empty prefix InClusterIPPool" )
704
+ g .Expect (webhook .validate (& v1alpha2.InClusterIPPool {}, namespacedPool )).Error ().NotTo ( HaveOccurred (), "should allow /0 prefix InClusterIPPool" )
705
+ g .Expect (webhook .validate (& v1alpha2.GlobalInClusterIPPool {}, globalPool )).Error ().NotTo ( HaveOccurred (), "should allow /0 prefix GlobalInClusterIPPool" )
706
+ g .Expect (webhook .validate (& v1alpha2.InClusterIPPool {}, emptyPrefixPool )).Error ().NotTo ( HaveOccurred (), "should allow empty prefix InClusterIPPool" )
707
707
}
708
708
709
709
func runInvalidScenarioTests (t * testing.T , tt invalidScenarioTest , pool types.GenericInClusterPool , webhook InClusterIPPool ) {
0 commit comments