@@ -92,11 +92,15 @@ func TestMachineHealthCheckLabelSelectorAsSelectorValidation(t *testing.T) {
92
92
},
93
93
}
94
94
if tt .expectErr {
95
- g .Expect (mhc .ValidateCreate ()).NotTo (Succeed ())
96
- g .Expect (mhc .ValidateUpdate (mhc )).NotTo (Succeed ())
95
+ _ , err := mhc .ValidateCreate ()
96
+ g .Expect (err ).To (HaveOccurred ())
97
+ _ , err = mhc .ValidateUpdate (mhc )
98
+ g .Expect (err ).To (HaveOccurred ())
97
99
} else {
98
- g .Expect (mhc .ValidateCreate ()).To (Succeed ())
99
- g .Expect (mhc .ValidateUpdate (mhc )).To (Succeed ())
100
+ _ , err := mhc .ValidateCreate ()
101
+ g .Expect (err ).NotTo (HaveOccurred ())
102
+ _ , err = mhc .ValidateUpdate (mhc )
103
+ g .Expect (err ).NotTo (HaveOccurred ())
100
104
}
101
105
})
102
106
}
@@ -160,10 +164,11 @@ func TestMachineHealthCheckClusterNameImmutable(t *testing.T) {
160
164
},
161
165
}
162
166
167
+ _ , err := newMHC .ValidateUpdate (oldMHC )
163
168
if tt .expectErr {
164
- g .Expect (newMHC . ValidateUpdate ( oldMHC )). NotTo ( Succeed ())
169
+ g .Expect (err ). To ( HaveOccurred ())
165
170
} else {
166
- g .Expect (newMHC . ValidateUpdate ( oldMHC )). To ( Succeed ())
171
+ g .Expect (err ). NotTo ( HaveOccurred ())
167
172
}
168
173
})
169
174
}
@@ -211,11 +216,15 @@ func TestMachineHealthCheckUnhealthyConditions(t *testing.T) {
211
216
},
212
217
}
213
218
if tt .expectErr {
214
- g .Expect (mhc .ValidateCreate ()).NotTo (Succeed ())
215
- g .Expect (mhc .ValidateUpdate (mhc )).NotTo (Succeed ())
219
+ _ , err := mhc .ValidateCreate ()
220
+ g .Expect (err ).To (HaveOccurred ())
221
+ _ , err = mhc .ValidateUpdate (mhc )
222
+ g .Expect (err ).To (HaveOccurred ())
216
223
} else {
217
- g .Expect (mhc .ValidateCreate ()).To (Succeed ())
218
- g .Expect (mhc .ValidateUpdate (mhc )).To (Succeed ())
224
+ _ , err := mhc .ValidateCreate ()
225
+ g .Expect (err ).NotTo (HaveOccurred ())
226
+ _ , err = mhc .ValidateUpdate (mhc )
227
+ g .Expect (err ).NotTo (HaveOccurred ())
219
228
}
220
229
})
221
230
}
@@ -286,11 +295,15 @@ func TestMachineHealthCheckNodeStartupTimeout(t *testing.T) {
286
295
}
287
296
288
297
if tt .expectErr {
289
- g .Expect (mhc .ValidateCreate ()).NotTo (Succeed ())
290
- g .Expect (mhc .ValidateUpdate (mhc )).NotTo (Succeed ())
298
+ _ , err := mhc .ValidateCreate ()
299
+ g .Expect (err ).To (HaveOccurred ())
300
+ _ , err = mhc .ValidateUpdate (mhc )
301
+ g .Expect (err ).To (HaveOccurred ())
291
302
} else {
292
- g .Expect (mhc .ValidateCreate ()).To (Succeed ())
293
- g .Expect (mhc .ValidateUpdate (mhc )).To (Succeed ())
303
+ _ , err := mhc .ValidateCreate ()
304
+ g .Expect (err ).NotTo (HaveOccurred ())
305
+ _ , err = mhc .ValidateUpdate (mhc )
306
+ g .Expect (err ).NotTo (HaveOccurred ())
294
307
}
295
308
}
296
309
}
@@ -345,11 +358,15 @@ func TestMachineHealthCheckMaxUnhealthy(t *testing.T) {
345
358
}
346
359
347
360
if tt .expectErr {
348
- g .Expect (mhc .ValidateCreate ()).NotTo (Succeed ())
349
- g .Expect (mhc .ValidateUpdate (mhc )).NotTo (Succeed ())
361
+ _ , err := mhc .ValidateCreate ()
362
+ g .Expect (err ).To (HaveOccurred ())
363
+ _ , err = mhc .ValidateUpdate (mhc )
364
+ g .Expect (err ).To (HaveOccurred ())
350
365
} else {
351
- g .Expect (mhc .ValidateCreate ()).To (Succeed ())
352
- g .Expect (mhc .ValidateUpdate (mhc )).To (Succeed ())
366
+ _ , err := mhc .ValidateCreate ()
367
+ g .Expect (err ).NotTo (HaveOccurred ())
368
+ _ , err = mhc .ValidateUpdate (mhc )
369
+ g .Expect (err ).NotTo (HaveOccurred ())
353
370
}
354
371
}
355
372
}
0 commit comments