This repository has been archived by the owner on Feb 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
job_test.go
600 lines (518 loc) · 18.8 KB
/
job_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package mxnet
import (
"context"
"testing"
"time"
"k8s.io/api/core/v1"
kubeclientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/record"
"k8s.io/kubernetes/pkg/controller"
"github.com/kubeflow/mxnet-operator/cmd/mxnet-operator.v1beta1/app/options"
mxv1beta1 "github.com/kubeflow/mxnet-operator/pkg/apis/mxnet/v1beta1"
mxjobclientset "github.com/kubeflow/mxnet-operator/pkg/client/clientset/versioned"
"github.com/kubeflow/mxnet-operator/pkg/common/util/v1beta1/testutil"
"github.com/kubeflow/tf-operator/pkg/control"
batchv1alpha1 "github.com/kubernetes-sigs/kube-batch/pkg/apis/scheduling/v1alpha1"
kubebatchclient "github.com/kubernetes-sigs/kube-batch/pkg/client/clientset/versioned"
)
func TestAddMXJob(t *testing.T) {
// Prepare the clientset and controller for the test.
kubeClientSet := kubeclientset.NewForConfigOrDie(&rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &v1.SchemeGroupVersion,
},
},
)
// Prepare the kube-batch clientset and controller for the test.
kubeBatchClientSet := kubebatchclient.NewForConfigOrDie(&rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &batchv1alpha1.SchemeGroupVersion,
},
},
)
config := &rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &mxv1beta1.SchemeGroupVersion,
},
}
mxJobClientSet := mxjobclientset.NewForConfigOrDie(config)
ctr, _, _ := newMXController(config, kubeClientSet, mxJobClientSet, kubeBatchClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
ctr.mxJobInformerSynced = testutil.AlwaysReady
ctr.PodInformerSynced = testutil.AlwaysReady
ctr.ServiceInformerSynced = testutil.AlwaysReady
mxJobIndexer := ctr.mxJobInformer.GetIndexer()
stopCh := make(chan struct{})
run := func(ctx context.Context) {
if err := ctr.Run(testutil.ThreadCount, stopCh); err != nil {
t.Errorf("Failed to run MXNet Controller!")
}
}
ctx, cancel := context.WithCancel(context.Background())
go run(ctx)
var key string
syncChan := make(chan string)
ctr.syncHandler = func(mxJobKey string) (bool, error) {
key = mxJobKey
<-syncChan
return true, nil
}
ctr.updateStatusHandler = func(mxjob *mxv1beta1.MXJob) error {
return nil
}
ctr.deleteMXJobHandler = func(mxjob *mxv1beta1.MXJob) error {
return nil
}
mxJob := testutil.NewMXJob(1, 0)
unstructured, err := testutil.ConvertMXJobToUnstructured(mxJob)
if err != nil {
t.Errorf("Failed to convert the MXJob to Unstructured: %v", err)
}
if err := mxJobIndexer.Add(unstructured); err != nil {
t.Errorf("Failed to add mxjob to mxJobIndexer: %v", err)
}
ctr.addMXJob(unstructured)
syncChan <- "sync"
if key != testutil.GetKey(mxJob, t) {
t.Errorf("Failed to enqueue the MXJob %s: expected %s, got %s", mxJob.Name, testutil.GetKey(mxJob, t), key)
}
cancel()
}
func TestCopyLabelsAndAnnotation(t *testing.T) {
// Prepare the clientset and controller for the test.
kubeClientSet := kubeclientset.NewForConfigOrDie(&rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &v1.SchemeGroupVersion,
},
},
)
// Prepare the kube-batch clientset and controller for the test.
kubeBatchClientSet := kubebatchclient.NewForConfigOrDie(&rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &batchv1alpha1.SchemeGroupVersion,
},
},
)
config := &rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &mxv1beta1.SchemeGroupVersion,
},
}
mxJobClientSet := mxjobclientset.NewForConfigOrDie(config)
ctr, _, _ := newMXController(config, kubeClientSet, mxJobClientSet, kubeBatchClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
fakePodControl := &controller.FakePodControl{}
ctr.PodControl = fakePodControl
ctr.mxJobInformerSynced = testutil.AlwaysReady
ctr.PodInformerSynced = testutil.AlwaysReady
ctr.ServiceInformerSynced = testutil.AlwaysReady
mxJobIndexer := ctr.mxJobInformer.GetIndexer()
stopCh := make(chan struct{})
run := func(<-chan struct{}) {
if err := ctr.Run(testutil.ThreadCount, stopCh); err != nil {
t.Errorf("Failed to run MXNet Controller!")
}
}
go run(stopCh)
ctr.updateStatusHandler = func(mxJob *mxv1beta1.MXJob) error {
return nil
}
mxJob := testutil.NewMXJob(1, 0)
annotations := map[string]string{
"annotation1": "1",
}
labels := map[string]string{
"label1": "1",
}
mxJob.Spec.MXReplicaSpecs[mxv1beta1.MXReplicaTypeWorker].Template.Labels = labels
mxJob.Spec.MXReplicaSpecs[mxv1beta1.MXReplicaTypeWorker].Template.Annotations = annotations
unstructured, err := testutil.ConvertMXJobToUnstructured(mxJob)
if err != nil {
t.Errorf("Failed to convert the MXJob to Unstructured: %v", err)
}
if err := mxJobIndexer.Add(unstructured); err != nil {
t.Errorf("Failed to add mxjob to mxJobIndexer: %v", err)
}
_, err = ctr.syncMXJob(testutil.GetKey(mxJob, t))
if err != nil {
t.Errorf("%s: unexpected error when syncing jobs %v", mxJob.Name, err)
}
if len(fakePodControl.Templates) != 1 {
t.Errorf("Expected to create 1 pod while got %d", len(fakePodControl.Templates))
}
actual := fakePodControl.Templates[0]
v, exist := actual.Labels["label1"]
if !exist {
t.Errorf("Labels does not exist")
}
if v != "1" {
t.Errorf("Labels value do not equal")
}
v, exist = actual.Annotations["annotation1"]
if !exist {
t.Errorf("Annotations does not exist")
}
if v != "1" {
t.Errorf("Annotations value does not equal")
}
}
func TestDeletePodsAndServices(t *testing.T) {
type testCase struct {
description string
mxJob *mxv1beta1.MXJob
pendingSchedulerPods int32
activeSchedulerPods int32
succeededSchedulerPods int32
failedSchedulerPods int32
pendingWorkerPods int32
activeWorkerPods int32
succeededWorkerPods int32
failedWorkerPods int32
pendingServerPods int32
activeServerPods int32
succeededServerPods int32
failedServerPods int32
activeSchedulerServices int32
activeWorkerServices int32
activeServerServices int32
expectedPodDeletions int
}
testCases := []testCase{
testCase{
description: "1 scheduler , 4 workers and 2 server is running, policy is all",
mxJob: testutil.NewMXJobWithCleanPolicy(1, 4, 2, mxv1beta1.CleanPodPolicyAll),
pendingSchedulerPods: 0,
activeSchedulerPods: 1,
succeededSchedulerPods: 0,
failedSchedulerPods: 0,
pendingWorkerPods: 0,
activeWorkerPods: 4,
succeededWorkerPods: 0,
failedWorkerPods: 0,
pendingServerPods: 0,
activeServerPods: 2,
succeededServerPods: 0,
failedServerPods: 0,
activeSchedulerServices: 1,
activeWorkerServices: 4,
activeServerServices: 2,
expectedPodDeletions: 7,
},
testCase{
description: "1 scheduler, 4 workers and 2 servers is running, policy is running",
mxJob: testutil.NewMXJobWithCleanPolicy(1, 4, 2, mxv1beta1.CleanPodPolicyRunning),
pendingSchedulerPods: 0,
activeSchedulerPods: 1,
succeededSchedulerPods: 0,
failedSchedulerPods: 0,
pendingWorkerPods: 0,
activeWorkerPods: 4,
succeededWorkerPods: 0,
failedWorkerPods: 0,
pendingServerPods: 0,
activeServerPods: 2,
succeededServerPods: 0,
failedServerPods: 0,
activeSchedulerServices: 1,
activeWorkerServices: 4,
activeServerServices: 2,
expectedPodDeletions: 7,
},
testCase{
description: "1 scheduler, 4 workers and 2 servers is succeeded, policy is running",
mxJob: testutil.NewMXJobWithCleanPolicy(1, 4, 2, mxv1beta1.CleanPodPolicyRunning),
pendingSchedulerPods: 0,
activeSchedulerPods: 0,
succeededSchedulerPods: 1,
failedSchedulerPods: 0,
pendingWorkerPods: 0,
activeWorkerPods: 0,
succeededWorkerPods: 4,
failedWorkerPods: 0,
pendingServerPods: 0,
activeServerPods: 0,
succeededServerPods: 2,
failedServerPods: 0,
activeSchedulerServices: 1,
activeWorkerServices: 4,
activeServerServices: 2,
expectedPodDeletions: 0,
},
testCase{
description: "1 scheduler, 4 workers and 2 servers is succeeded, policy is None",
mxJob: testutil.NewMXJobWithCleanPolicy(1, 4, 2, mxv1beta1.CleanPodPolicyNone),
pendingSchedulerPods: 0,
activeSchedulerPods: 0,
succeededSchedulerPods: 1,
failedSchedulerPods: 0,
pendingWorkerPods: 0,
activeWorkerPods: 0,
succeededWorkerPods: 4,
failedWorkerPods: 0,
pendingServerPods: 0,
activeServerPods: 0,
succeededServerPods: 2,
failedServerPods: 0,
activeSchedulerServices: 1,
activeWorkerServices: 4,
activeServerServices: 2,
expectedPodDeletions: 0,
},
}
for _, tc := range testCases {
// Prepare the clientset and controller for the test.
kubeClientSet := kubeclientset.NewForConfigOrDie(&rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &v1.SchemeGroupVersion,
},
},
)
// Prepare the kube-batch clientset and controller for the test.
kubeBatchClientSet := kubebatchclient.NewForConfigOrDie(&rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &batchv1alpha1.SchemeGroupVersion,
},
},
)
config := &rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &mxv1beta1.SchemeGroupVersion,
},
}
mxJobClientSet := mxjobclientset.NewForConfigOrDie(config)
ctr, kubeInformerFactory, _ := newMXController(config, kubeClientSet, mxJobClientSet, kubeBatchClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
fakePodControl := &controller.FakePodControl{}
ctr.PodControl = fakePodControl
fakeServiceControl := &control.FakeServiceControl{}
ctr.ServiceControl = fakeServiceControl
ctr.Recorder = &record.FakeRecorder{}
ctr.mxJobInformerSynced = testutil.AlwaysReady
ctr.PodInformerSynced = testutil.AlwaysReady
ctr.ServiceInformerSynced = testutil.AlwaysReady
mxJobIndexer := ctr.mxJobInformer.GetIndexer()
ctr.updateStatusHandler = func(mxJob *mxv1beta1.MXJob) error {
return nil
}
// Set succeeded to run the logic about deleting.
err := updateMXJobConditions(tc.mxJob, mxv1beta1.MXJobSucceeded, mxJobSucceededReason, "")
if err != nil {
t.Errorf("Append mxjob condition error: %v", err)
}
unstructured, err := testutil.ConvertMXJobToUnstructured(tc.mxJob)
if err != nil {
t.Errorf("Failed to convert the MXJob to Unstructured: %v", err)
}
if err := mxJobIndexer.Add(unstructured); err != nil {
t.Errorf("Failed to add mxjob to mxJobIndexer: %v", err)
}
podIndexer := kubeInformerFactory.Core().V1().Pods().Informer().GetIndexer()
testutil.SetPodsStatuses(podIndexer, tc.mxJob, testutil.LabelScheduler, tc.pendingSchedulerPods, tc.activeSchedulerPods, tc.succeededSchedulerPods, tc.failedSchedulerPods, t)
testutil.SetPodsStatuses(podIndexer, tc.mxJob, testutil.LabelWorker, tc.pendingWorkerPods, tc.activeWorkerPods, tc.succeededWorkerPods, tc.failedWorkerPods, t)
testutil.SetPodsStatuses(podIndexer, tc.mxJob, testutil.LabelServer, tc.pendingServerPods, tc.activeServerPods, tc.succeededServerPods, tc.failedServerPods, t)
serviceIndexer := kubeInformerFactory.Core().V1().Services().Informer().GetIndexer()
testutil.SetServices(serviceIndexer, tc.mxJob, testutil.LabelScheduler, tc.activeSchedulerServices, t)
testutil.SetServices(serviceIndexer, tc.mxJob, testutil.LabelWorker, tc.activeWorkerServices, t)
testutil.SetServices(serviceIndexer, tc.mxJob, testutil.LabelServer, tc.activeServerServices, t)
forget, err := ctr.syncMXJob(testutil.GetKey(tc.mxJob, t))
if err != nil {
t.Errorf("%s: unexpected error when syncing jobs %v", tc.description, err)
}
if !forget {
t.Errorf("%s: unexpected forget value. Expected true, saw %v\n", tc.description, forget)
}
if len(fakePodControl.DeletePodName) != tc.expectedPodDeletions {
t.Errorf("%s: unexpected number of pod deletes. Expected %d, saw %d\n", tc.description, tc.expectedPodDeletions, len(fakePodControl.DeletePodName))
}
if len(fakeServiceControl.DeleteServiceName) != tc.expectedPodDeletions {
t.Errorf("%s: unexpected number of service deletes. Expected %d, saw %d\n", tc.description, tc.expectedPodDeletions, len(fakeServiceControl.DeleteServiceName))
}
}
}
func TestCleanupMXJob(t *testing.T) {
type testCase struct {
description string
mxJob *mxv1beta1.MXJob
pendingSchedulerPods int32
activeSchedulerPods int32
succeededSchedulerPods int32
failedSchedulerPods int32
pendingWorkerPods int32
activeWorkerPods int32
succeededWorkerPods int32
failedWorkerPods int32
pendingServerPods int32
activeServerPods int32
succeededServerPods int32
failedServerPods int32
activeSchedulerServices int32
activeWorkerServices int32
activeServerServices int32
expectedDeleteFinished bool
}
ttlaf0 := int32(0)
ttl0 := &ttlaf0
ttlaf2s := int32(2)
ttl2s := &ttlaf2s
testCases := []testCase{
testCase{
description: "1 scheduler , 4 workers and 2 server is running, TTLSecondsAfterFinished unset",
mxJob: testutil.NewMXJobWithCleanupJobDelay(1, 4, 2, nil),
pendingSchedulerPods: 0,
activeSchedulerPods: 1,
succeededSchedulerPods: 0,
failedSchedulerPods: 0,
pendingWorkerPods: 0,
activeWorkerPods: 4,
succeededWorkerPods: 0,
failedWorkerPods: 0,
pendingServerPods: 0,
activeServerPods: 2,
succeededServerPods: 0,
failedServerPods: 0,
activeSchedulerServices: 1,
activeWorkerServices: 4,
activeServerServices: 2,
expectedDeleteFinished: false,
},
testCase{
description: "1 scheduler, 4 workers and 2 servers is running, TTLSecondsAfterFinished is 0",
mxJob: testutil.NewMXJobWithCleanupJobDelay(1, 4, 2, ttl0),
pendingSchedulerPods: 0,
activeSchedulerPods: 1,
succeededSchedulerPods: 0,
failedSchedulerPods: 0,
pendingWorkerPods: 0,
activeWorkerPods: 4,
succeededWorkerPods: 0,
failedWorkerPods: 0,
pendingServerPods: 0,
activeServerPods: 2,
succeededServerPods: 0,
failedServerPods: 0,
activeSchedulerServices: 1,
activeWorkerServices: 4,
activeServerServices: 2,
expectedDeleteFinished: true,
},
testCase{
description: "1 scheduler, 4 workers and 2 servers is succeeded, TTLSecondsAfterFinished is 2",
mxJob: testutil.NewMXJobWithCleanupJobDelay(1, 4, 2, ttl2s),
pendingSchedulerPods: 0,
activeSchedulerPods: 0,
succeededSchedulerPods: 1,
failedSchedulerPods: 0,
pendingWorkerPods: 0,
activeWorkerPods: 0,
succeededWorkerPods: 4,
failedWorkerPods: 0,
pendingServerPods: 0,
activeServerPods: 0,
succeededServerPods: 2,
failedServerPods: 0,
activeSchedulerServices: 1,
activeWorkerServices: 4,
activeServerServices: 2,
expectedDeleteFinished: true,
},
}
for _, tc := range testCases {
// Prepare the clientset and controller for the test.
kubeClientSet := kubeclientset.NewForConfigOrDie(&rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &v1.SchemeGroupVersion,
},
},
)
// Prepare the kube-batch clientset and controller for the test.
kubeBatchClientSet := kubebatchclient.NewForConfigOrDie(&rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &batchv1alpha1.SchemeGroupVersion,
},
},
)
config := &rest.Config{
Host: "",
ContentConfig: rest.ContentConfig{
GroupVersion: &mxv1beta1.SchemeGroupVersion,
},
}
mxJobClientSet := mxjobclientset.NewForConfigOrDie(config)
ctr, kubeInformerFactory, _ := newMXController(config, kubeClientSet, mxJobClientSet, kubeBatchClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
fakePodControl := &controller.FakePodControl{}
ctr.PodControl = fakePodControl
fakeServiceControl := &control.FakeServiceControl{}
ctr.ServiceControl = fakeServiceControl
ctr.Recorder = &record.FakeRecorder{}
ctr.mxJobInformerSynced = testutil.AlwaysReady
ctr.PodInformerSynced = testutil.AlwaysReady
ctr.ServiceInformerSynced = testutil.AlwaysReady
mxJobIndexer := ctr.mxJobInformer.GetIndexer()
ctr.updateStatusHandler = func(mxJob *mxv1beta1.MXJob) error {
return nil
}
deleteFinished := false
ctr.deleteMXJobHandler = func(mxJob *mxv1beta1.MXJob) error {
deleteFinished = true
return nil
}
// Set succeeded to run the logic about deleting.
testutil.SetMXJobCompletionTime(tc.mxJob)
err := updateMXJobConditions(tc.mxJob, mxv1beta1.MXJobSucceeded, mxJobSucceededReason, "")
if err != nil {
t.Errorf("Append mxjob condition error: %v", err)
}
unstructured, err := testutil.ConvertMXJobToUnstructured(tc.mxJob)
if err != nil {
t.Errorf("Failed to convert the MXJob to Unstructured: %v", err)
}
if err := mxJobIndexer.Add(unstructured); err != nil {
t.Errorf("Failed to add mxjob to mxJobIndexer: %v", err)
}
podIndexer := kubeInformerFactory.Core().V1().Pods().Informer().GetIndexer()
testutil.SetPodsStatuses(podIndexer, tc.mxJob, testutil.LabelScheduler, tc.pendingSchedulerPods, tc.activeSchedulerPods, tc.succeededSchedulerPods, tc.failedSchedulerPods, t)
testutil.SetPodsStatuses(podIndexer, tc.mxJob, testutil.LabelWorker, tc.pendingWorkerPods, tc.activeWorkerPods, tc.succeededWorkerPods, tc.failedWorkerPods, t)
testutil.SetPodsStatuses(podIndexer, tc.mxJob, testutil.LabelServer, tc.pendingServerPods, tc.activeServerPods, tc.succeededServerPods, tc.failedServerPods, t)
serviceIndexer := kubeInformerFactory.Core().V1().Services().Informer().GetIndexer()
testutil.SetServices(serviceIndexer, tc.mxJob, testutil.LabelScheduler, tc.activeSchedulerServices, t)
testutil.SetServices(serviceIndexer, tc.mxJob, testutil.LabelWorker, tc.activeWorkerServices, t)
testutil.SetServices(serviceIndexer, tc.mxJob, testutil.LabelServer, tc.activeServerServices, t)
ttl := tc.mxJob.Spec.TTLSecondsAfterFinished
if ttl != nil {
dur := time.Second * time.Duration(*ttl)
time.Sleep(dur)
}
forget, err := ctr.syncMXJob(testutil.GetKey(tc.mxJob, t))
if err != nil {
t.Errorf("%s: unexpected error when syncing jobs %v", tc.description, err)
}
if !forget {
t.Errorf("%s: unexpected forget value. Expected true, saw %v\n", tc.description, forget)
}
if deleteFinished != tc.expectedDeleteFinished {
t.Errorf("%s: unexpected status. Expected %v, saw %v", tc.description, tc.expectedDeleteFinished, deleteFinished)
}
}
}