@@ -167,7 +167,7 @@ func TestPodMemoryTarget(t *testing.T) {
167
167
}
168
168
169
169
for _ , testCase := range testCases {
170
- pod := Pod (testCase .input , "name" , "opmImage" , "image" , "service-account" , map [string ]string {}, map [string ]string {}, int32 (0 ), int32 (0 ), int64 (workloadUserID ))
170
+ pod := Pod (testCase .input , "name" , "opmImage" , "utilImage" , " image" , "service-account" , map [string ]string {}, map [string ]string {}, int32 (0 ), int32 (0 ), int64 (workloadUserID ))
171
171
if diff := cmp .Diff (pod , testCase .expected ); diff != "" {
172
172
t .Errorf ("got incorrect pod: %v" , diff )
173
173
}
@@ -267,7 +267,7 @@ func TestPodExtractContent(t *testing.T) {
267
267
ObjectMeta : metav1.ObjectMeta {
268
268
GenerateName : "test-" ,
269
269
Namespace : "testns" ,
270
- Labels : map [string ]string {"olm.pod-spec-hash" : "c748655d4 " , "olm.managed" : "true" },
270
+ Labels : map [string ]string {"olm.pod-spec-hash" : "667f4b9769 " , "olm.managed" : "true" },
271
271
Annotations : map [string ]string {"cluster-autoscaler.kubernetes.io/safe-to-evict" : "true" },
272
272
},
273
273
Spec : corev1.PodSpec {
@@ -284,16 +284,21 @@ func TestPodExtractContent(t *testing.T) {
284
284
InitContainers : []corev1.Container {
285
285
{
286
286
Name : "extract-utilities" ,
287
- Image : "opmImage " ,
288
- Command : []string {"sh" , "-c " },
289
- Args : []string {"cp $( command -v sh ) /utilities/sh && cp $( command -v cp ) /utilities/cp " },
287
+ Image : "utilImage " ,
288
+ Command : []string {"cp " },
289
+ Args : []string {"/bin/copy-content" , " /utilities/copy-content " },
290
290
VolumeMounts : []corev1.VolumeMount {{Name : "utilities" , MountPath : "/utilities" }},
291
291
},
292
292
{
293
293
Name : "extract-content" ,
294
294
Image : "image" ,
295
- Command : []string {"/utilities/sh" , "-c" },
296
- Args : []string {"/utilities/cp -r /catalog /extracted-catalog/catalog && /utilities/cp -r /tmp/cache /extracted-catalog/cache" },
295
+ Command : []string {"/utilities/copy-content" },
296
+ Args : []string {
297
+ "--catalog.from=/catalog" ,
298
+ "--catalog.to=/extracted-catalog/catalog" ,
299
+ "--cache.from=/tmp/cache" ,
300
+ "--cache.to=/extracted-catalog/cache" ,
301
+ },
297
302
VolumeMounts : []corev1.VolumeMount {
298
303
{Name : "utilities" , MountPath : "/utilities" },
299
304
{Name : "catalog-content" , MountPath : "/extracted-catalog" },
@@ -357,7 +362,7 @@ func TestPodExtractContent(t *testing.T) {
357
362
}
358
363
359
364
for _ , testCase := range testCases {
360
- pod := Pod (testCase .input , "name" , "opmImage" , "image" , "service-account" , map [string ]string {}, map [string ]string {}, int32 (0 ), int32 (0 ), int64 (workloadUserID ))
365
+ pod := Pod (testCase .input , "name" , "opmImage" , "utilImage" , " image" , "service-account" , map [string ]string {}, map [string ]string {}, int32 (0 ), int32 (0 ), int64 (workloadUserID ))
361
366
if diff := cmp .Diff (pod , testCase .expected ); diff != "" {
362
367
t .Errorf ("got incorrect pod: %v" , diff )
363
368
}
@@ -375,7 +380,7 @@ func TestPodNodeSelector(t *testing.T) {
375
380
key := "kubernetes.io/os"
376
381
value := "linux"
377
382
378
- gotCatSrcPod := Pod (catsrc , "hello" , "opmImage" , "busybox" , "" , map [string ]string {}, map [string ]string {}, int32 (0 ), int32 (0 ), int64 (workloadUserID ))
383
+ gotCatSrcPod := Pod (catsrc , "hello" , "utilImage" , " opmImage" , "busybox" , "" , map [string ]string {}, map [string ]string {}, int32 (0 ), int32 (0 ), int64 (workloadUserID ))
379
384
gotCatSrcPodSelector := gotCatSrcPod .Spec .NodeSelector
380
385
381
386
if gotCatSrcPodSelector [key ] != value {
@@ -423,7 +428,7 @@ func TestPullPolicy(t *testing.T) {
423
428
}
424
429
425
430
for _ , tt := range table {
426
- p := Pod (source , "catalog" , "opmImage" , tt .image , "" , nil , nil , int32 (0 ), int32 (0 ), int64 (workloadUserID ))
431
+ p := Pod (source , "catalog" , "opmImage" , "utilImage" , tt .image , "" , nil , nil , int32 (0 ), int32 (0 ), int64 (workloadUserID ))
427
432
policy := p .Spec .Containers [0 ].ImagePullPolicy
428
433
if policy != tt .policy {
429
434
t .Fatalf ("expected pull policy %s for image %s" , tt .policy , tt .image )
@@ -535,7 +540,7 @@ func TestPodContainerSecurityContext(t *testing.T) {
535
540
},
536
541
}
537
542
for _ , testcase := range testcases {
538
- outputPod := Pod (testcase .inputCatsrc , "hello" , "opmImage" , "busybox" , "" , map [string ]string {}, map [string ]string {}, int32 (0 ), int32 (0 ), int64 (workloadUserID ))
543
+ outputPod := Pod (testcase .inputCatsrc , "hello" , "utilImage" , " opmImage" , "busybox" , "" , map [string ]string {}, map [string ]string {}, int32 (0 ), int32 (0 ), int64 (workloadUserID ))
539
544
if testcase .expectedSecurityContext != nil {
540
545
require .Equal (t , testcase .expectedSecurityContext , outputPod .Spec .SecurityContext )
541
546
}
@@ -565,7 +570,7 @@ func TestPodAvoidsConcurrentWrite(t *testing.T) {
565
570
"annotation" : "somethingelse" ,
566
571
}
567
572
568
- gotPod := Pod (catsrc , "hello" , "opmImage" , "busybox" , "" , labels , annotations , int32 (0 ), int32 (0 ), int64 (workloadUserID ))
573
+ gotPod := Pod (catsrc , "hello" , "opmImage" , "utilImage" , " busybox" , "" , labels , annotations , int32 (0 ), int32 (0 ), int64 (workloadUserID ))
569
574
570
575
// check labels and annotations point to different addresses between parameters and what's in the pod
571
576
require .NotEqual (t , & labels , & gotPod .Labels )
@@ -794,7 +799,7 @@ func TestPodSchedulingOverrides(t *testing.T) {
794
799
}
795
800
796
801
for _ , testCase := range testCases {
797
- pod := Pod (testCase .catalogSource , "hello" , "opmImage" , "busybox" , "" , map [string ]string {}, testCase .annotations , int32 (0 ), int32 (0 ), int64 (workloadUserID ))
802
+ pod := Pod (testCase .catalogSource , "hello" , "opmImage" , "utilImage" , " busybox" , "" , map [string ]string {}, testCase .annotations , int32 (0 ), int32 (0 ), int64 (workloadUserID ))
798
803
require .Equal (t , testCase .expectedNodeSelectors , pod .Spec .NodeSelector )
799
804
require .Equal (t , testCase .expectedPriorityClassName , pod .Spec .PriorityClassName )
800
805
require .Equal (t , testCase .expectedTolerations , pod .Spec .Tolerations )
0 commit comments