@@ -78,13 +78,13 @@ func TestPoolDeletionWithExistingIPAddresses(t *testing.T) {
7878 Client : fakeClient ,
7979 }
8080
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" )
8383
8484 g .Expect (fakeClient .DeleteAllOf (ctx , & ipamv1.IPAddress {})).To (Succeed ())
8585
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" )
8888}
8989
9090func TestUpdatingPoolInUseAddresses (t * testing.T ) {
@@ -135,8 +135,8 @@ func TestUpdatingPoolInUseAddresses(t *testing.T) {
135135 namespacedPool .Spec .Addresses = []string {"10.0.0.15-10.0.0.20" }
136136 globalPool .Spec .Addresses = []string {"10.0.0.15-10.0.0.20" }
137137
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" )
140140}
141141
142142func TestDeleteSkip (t * testing.T ) {
@@ -188,8 +188,8 @@ func TestDeleteSkip(t *testing.T) {
188188 Client : fakeClient ,
189189 }
190190
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 ())
193193}
194194
195195func TestInClusterIPPoolDefaulting (t * testing.T ) {
@@ -701,9 +701,9 @@ func TestIPPool_Prefix(t *testing.T) {
701701 Client : fakeClient ,
702702 }
703703
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" )
707707}
708708
709709func runInvalidScenarioTests (t * testing.T , tt invalidScenarioTest , pool types.GenericInClusterPool , webhook InClusterIPPool ) {
0 commit comments