@@ -213,42 +213,29 @@ func TestWorkloadReconciler(t *testing.T) {
213
213
request : baseRequest ,
214
214
objs : []client.Object {
215
215
baseAdmissionCheckWrapper .DeepCopy (),
216
+ baseJobSetWrapper .DeepCopy (),
217
+ basePod1Wrapper .DeepCopy (),
216
218
baseWorkloadWrapperWithAdmissionAndOwner .Clone ().
217
219
Active (false ).
218
220
Finalizers (SliceControllerName ).
219
221
Obj (),
220
- baseSliceWrapper .Clone ().
221
- Finalizers (SliceControllerName ).
222
- DeletionTimestamp (now ).
223
- Deformed ().
224
- Obj (),
222
+ baseSliceWrapper .Clone ().Deformed ().Obj (),
225
223
},
226
224
wantWorkloads : []kueue.Workload {
227
- * baseWorkloadWrapperWithAdmissionAndOwner .Clone ().
228
- Active (false ).
229
- Obj (),
230
- },
231
- wantSlices : []slice.Slice {
232
- * baseSliceWrapper .Clone ().
233
- Finalizers (SliceControllerName ).
234
- DeletionTimestamp (now ).
235
- Deformed ().
236
- Obj (),
225
+ * baseWorkloadWrapperWithAdmissionAndOwner .Clone ().Active (false ).Obj (),
237
226
},
238
227
},
239
228
"shouldn't delete the finalizer because the Slice status Degraded" : {
240
229
request : baseRequest ,
241
230
objs : []client.Object {
242
231
baseAdmissionCheckWrapper .DeepCopy (),
232
+ baseJobSetWrapper .DeepCopy (),
233
+ basePod1Wrapper .DeepCopy (),
243
234
baseWorkloadWrapperWithAdmissionAndOwner .Clone ().
244
235
Active (false ).
245
236
Finalizers (SliceControllerName ).
246
237
Obj (),
247
- baseSliceWrapper .Clone ().
248
- Finalizers (SliceControllerName ).
249
- DeletionTimestamp (now ).
250
- Degraded ().
251
- Obj (),
238
+ baseSliceWrapper .Clone ().Degraded ().Obj (),
252
239
},
253
240
wantWorkloads : []kueue.Workload {
254
241
* baseWorkloadWrapperWithAdmissionAndOwner .Clone ().
@@ -257,11 +244,7 @@ func TestWorkloadReconciler(t *testing.T) {
257
244
Obj (),
258
245
},
259
246
wantSlices : []slice.Slice {
260
- * baseSliceWrapper .Clone ().
261
- Finalizers (SliceControllerName ).
262
- DeletionTimestamp (now ).
263
- Degraded ().
264
- Obj (),
247
+ * baseSliceWrapper .Clone ().Degraded ().Obj (),
265
248
},
266
249
},
267
250
"should delete the Slice because the Pod Status Succeeded" : {
@@ -273,17 +256,13 @@ func TestWorkloadReconciler(t *testing.T) {
273
256
Active (false ).
274
257
Finalizers (SliceControllerName ).
275
258
Obj (),
276
- baseSliceWrapper .Clone (). Finalizers ( SliceControllerName ). Obj (),
259
+ baseSliceWrapper .DeepCopy (),
277
260
},
278
261
wantWorkloads : []kueue.Workload {
279
262
* baseWorkloadWrapperWithAdmissionAndOwner .Clone ().
280
263
Active (false ).
281
- Finalizers (SliceControllerName ).
282
264
Obj (),
283
265
},
284
- wantSlices : []slice.Slice {
285
- * baseSliceWrapper .Clone ().Finalizers (SliceControllerName ).DeletionTimestamp (now ).Obj (),
286
- },
287
266
},
288
267
"should delete the Slice because the Pod Status PodFailed" : {
289
268
request : baseRequest ,
@@ -295,17 +274,13 @@ func TestWorkloadReconciler(t *testing.T) {
295
274
Active (false ).
296
275
Finalizers (SliceControllerName ).
297
276
Obj (),
298
- baseSliceWrapper .Clone (). Finalizers ( SliceControllerName ). Obj (),
277
+ baseSliceWrapper .DeepCopy (),
299
278
},
300
279
wantWorkloads : []kueue.Workload {
301
280
* baseWorkloadWrapperWithAdmissionAndOwner .Clone ().
302
281
Active (false ).
303
- Finalizers (SliceControllerName ).
304
282
Obj (),
305
283
},
306
- wantSlices : []slice.Slice {
307
- * baseSliceWrapper .Clone ().Finalizers (SliceControllerName ).DeletionTimestamp (now ).Obj (),
308
- },
309
284
},
310
285
"shouldn't delete the Slice because the Pods still running" : {
311
286
request : baseRequest ,
@@ -318,7 +293,7 @@ func TestWorkloadReconciler(t *testing.T) {
318
293
Active (false ).
319
294
Finalizers (SliceControllerName ).
320
295
Obj (),
321
- baseSliceWrapper .Clone (). Finalizers ( SliceControllerName ). Obj (),
296
+ baseSliceWrapper .DeepCopy (),
322
297
},
323
298
wantWorkloads : []kueue.Workload {
324
299
* baseWorkloadWrapperWithAdmissionAndOwner .Clone ().
@@ -327,7 +302,7 @@ func TestWorkloadReconciler(t *testing.T) {
327
302
Obj (),
328
303
},
329
304
wantSlices : []slice.Slice {
330
- * baseSliceWrapper .Clone (). Finalizers ( SliceControllerName ). Obj (),
305
+ * baseSliceWrapper .DeepCopy (),
331
306
},
332
307
},
333
308
"shouldn't delete the Slice because one of the Pods still running" : {
@@ -341,7 +316,7 @@ func TestWorkloadReconciler(t *testing.T) {
341
316
Active (false ).
342
317
Finalizers (SliceControllerName ).
343
318
Obj (),
344
- baseSliceWrapper .Clone (). Finalizers ( SliceControllerName ). Obj (),
319
+ baseSliceWrapper .DeepCopy (),
345
320
},
346
321
wantWorkloads : []kueue.Workload {
347
322
* baseWorkloadWrapperWithAdmissionAndOwner .Clone ().
@@ -350,7 +325,7 @@ func TestWorkloadReconciler(t *testing.T) {
350
325
Obj (),
351
326
},
352
327
wantSlices : []slice.Slice {
353
- * baseSliceWrapper .Clone (). Finalizers ( SliceControllerName ). Obj (),
328
+ * baseSliceWrapper .DeepCopy (),
354
329
},
355
330
},
356
331
"shouldn't add finalizer because invalid TPU topology annotation" : {
0 commit comments