@@ -68,29 +68,6 @@ func TestConfigMapUnpacker(t *testing.T) {
68
68
roleBindings []* rbacv1.RoleBinding
69
69
}
70
70
71
- var expectedReadOnlyRootFilesystem = false
72
- var expectedAllowPrivilegeEscalation = false
73
- var expectedRunAsNonRoot = true
74
- var expectedRunAsUser int64 = 1001
75
- var expectedPrivileged = false
76
-
77
- var expectedContainerSecurityContext = & corev1.SecurityContext {
78
- Privileged : & expectedPrivileged ,
79
- ReadOnlyRootFilesystem : & expectedReadOnlyRootFilesystem ,
80
- AllowPrivilegeEscalation : & expectedAllowPrivilegeEscalation ,
81
- Capabilities : & corev1.Capabilities {
82
- Drop : []corev1.Capability {"ALL" },
83
- },
84
- }
85
-
86
- var expectedPodSecurityContext = & corev1.PodSecurityContext {
87
- RunAsNonRoot : & expectedRunAsNonRoot ,
88
- RunAsUser : & expectedRunAsUser ,
89
- SeccompProfile : & corev1.SeccompProfile {
90
- Type : corev1 .SeccompProfileTypeRuntimeDefault ,
91
- },
92
- }
93
-
94
71
tests := []struct {
95
72
description string
96
73
fields fields
@@ -243,7 +220,6 @@ func TestConfigMapUnpacker(t *testing.T) {
243
220
Spec : corev1.PodSpec {
244
221
RestartPolicy : corev1 .RestartPolicyNever ,
245
222
ImagePullSecrets : []corev1.LocalObjectReference {{Name : "my-secret" }},
246
- SecurityContext : expectedPodSecurityContext ,
247
223
Containers : []corev1.Container {
248
224
{
249
225
Name : "extract" ,
@@ -267,7 +243,6 @@ func TestConfigMapUnpacker(t *testing.T) {
267
243
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
268
244
},
269
245
},
270
- SecurityContext : expectedContainerSecurityContext ,
271
246
},
272
247
},
273
248
InitContainers : []corev1.Container {
@@ -287,7 +262,6 @@ func TestConfigMapUnpacker(t *testing.T) {
287
262
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
288
263
},
289
264
},
290
- SecurityContext : expectedContainerSecurityContext ,
291
265
},
292
266
{
293
267
Name : "pull" ,
@@ -310,7 +284,6 @@ func TestConfigMapUnpacker(t *testing.T) {
310
284
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
311
285
},
312
286
},
313
- SecurityContext : expectedContainerSecurityContext ,
314
287
},
315
288
},
316
289
Volumes : []corev1.Volume {
@@ -353,7 +326,7 @@ func TestConfigMapUnpacker(t *testing.T) {
353
326
"" ,
354
327
},
355
328
Verbs : []string {
356
- "get" , "update" ,
329
+ "create" , " get" , "update" ,
357
330
},
358
331
Resources : []string {
359
332
"configmaps" ,
@@ -423,8 +396,7 @@ func TestConfigMapUnpacker(t *testing.T) {
423
396
Name : pathHash ,
424
397
},
425
398
Spec : corev1.PodSpec {
426
- RestartPolicy : corev1 .RestartPolicyNever ,
427
- SecurityContext : expectedPodSecurityContext ,
399
+ RestartPolicy : corev1 .RestartPolicyNever ,
428
400
Containers : []corev1.Container {
429
401
{
430
402
Name : "extract" ,
@@ -448,7 +420,6 @@ func TestConfigMapUnpacker(t *testing.T) {
448
420
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
449
421
},
450
422
},
451
- SecurityContext : expectedContainerSecurityContext ,
452
423
},
453
424
},
454
425
InitContainers : []corev1.Container {
@@ -468,7 +439,6 @@ func TestConfigMapUnpacker(t *testing.T) {
468
439
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
469
440
},
470
441
},
471
- SecurityContext : expectedContainerSecurityContext ,
472
442
},
473
443
{
474
444
Name : "pull" ,
@@ -491,7 +461,6 @@ func TestConfigMapUnpacker(t *testing.T) {
491
461
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
492
462
},
493
463
},
494
- SecurityContext : expectedContainerSecurityContext ,
495
464
},
496
465
},
497
466
Volumes : []corev1.Volume {
@@ -645,8 +614,7 @@ func TestConfigMapUnpacker(t *testing.T) {
645
614
Name : pathHash ,
646
615
},
647
616
Spec : corev1.PodSpec {
648
- RestartPolicy : corev1 .RestartPolicyNever ,
649
- SecurityContext : expectedPodSecurityContext ,
617
+ RestartPolicy : corev1 .RestartPolicyNever ,
650
618
Containers : []corev1.Container {
651
619
{
652
620
Name : "extract" ,
@@ -670,7 +638,6 @@ func TestConfigMapUnpacker(t *testing.T) {
670
638
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
671
639
},
672
640
},
673
- SecurityContext : expectedContainerSecurityContext ,
674
641
},
675
642
},
676
643
InitContainers : []corev1.Container {
@@ -690,7 +657,6 @@ func TestConfigMapUnpacker(t *testing.T) {
690
657
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
691
658
},
692
659
},
693
- SecurityContext : expectedContainerSecurityContext ,
694
660
},
695
661
{
696
662
Name : "pull" ,
@@ -713,7 +679,6 @@ func TestConfigMapUnpacker(t *testing.T) {
713
679
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
714
680
},
715
681
},
716
- SecurityContext : expectedContainerSecurityContext ,
717
682
},
718
683
},
719
684
Volumes : []corev1.Volume {
@@ -769,7 +734,7 @@ func TestConfigMapUnpacker(t *testing.T) {
769
734
"" ,
770
735
},
771
736
Verbs : []string {
772
- "get" , "update" ,
737
+ "create" , " get" , "update" ,
773
738
},
774
739
Resources : []string {
775
740
"configmaps" ,
@@ -861,8 +826,7 @@ func TestConfigMapUnpacker(t *testing.T) {
861
826
Name : pathHash ,
862
827
},
863
828
Spec : corev1.PodSpec {
864
- RestartPolicy : corev1 .RestartPolicyNever ,
865
- SecurityContext : expectedPodSecurityContext ,
829
+ RestartPolicy : corev1 .RestartPolicyNever ,
866
830
Containers : []corev1.Container {
867
831
{
868
832
Name : "extract" ,
@@ -886,7 +850,6 @@ func TestConfigMapUnpacker(t *testing.T) {
886
850
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
887
851
},
888
852
},
889
- SecurityContext : expectedContainerSecurityContext ,
890
853
},
891
854
},
892
855
InitContainers : []corev1.Container {
@@ -906,7 +869,6 @@ func TestConfigMapUnpacker(t *testing.T) {
906
869
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
907
870
},
908
871
},
909
- SecurityContext : expectedContainerSecurityContext ,
910
872
},
911
873
{
912
874
Name : "pull" ,
@@ -929,7 +891,6 @@ func TestConfigMapUnpacker(t *testing.T) {
929
891
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
930
892
},
931
893
},
932
- SecurityContext : expectedContainerSecurityContext ,
933
894
},
934
895
},
935
896
Volumes : []corev1.Volume {
@@ -1047,8 +1008,7 @@ func TestConfigMapUnpacker(t *testing.T) {
1047
1008
Name : pathHash ,
1048
1009
},
1049
1010
Spec : corev1.PodSpec {
1050
- RestartPolicy : corev1 .RestartPolicyNever ,
1051
- SecurityContext : expectedPodSecurityContext ,
1011
+ RestartPolicy : corev1 .RestartPolicyNever ,
1052
1012
Containers : []corev1.Container {
1053
1013
{
1054
1014
Name : "extract" ,
@@ -1072,7 +1032,6 @@ func TestConfigMapUnpacker(t *testing.T) {
1072
1032
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
1073
1033
},
1074
1034
},
1075
- SecurityContext : expectedContainerSecurityContext ,
1076
1035
},
1077
1036
},
1078
1037
InitContainers : []corev1.Container {
@@ -1092,7 +1051,6 @@ func TestConfigMapUnpacker(t *testing.T) {
1092
1051
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
1093
1052
},
1094
1053
},
1095
- SecurityContext : expectedContainerSecurityContext ,
1096
1054
},
1097
1055
{
1098
1056
Name : "pull" ,
@@ -1115,7 +1073,6 @@ func TestConfigMapUnpacker(t *testing.T) {
1115
1073
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
1116
1074
},
1117
1075
},
1118
- SecurityContext : expectedContainerSecurityContext ,
1119
1076
},
1120
1077
},
1121
1078
Volumes : []corev1.Volume {
@@ -1244,8 +1201,7 @@ func TestConfigMapUnpacker(t *testing.T) {
1244
1201
Name : pathHash ,
1245
1202
},
1246
1203
Spec : corev1.PodSpec {
1247
- RestartPolicy : corev1 .RestartPolicyNever ,
1248
- SecurityContext : expectedPodSecurityContext ,
1204
+ RestartPolicy : corev1 .RestartPolicyNever ,
1249
1205
Containers : []corev1.Container {
1250
1206
{
1251
1207
Name : "extract" ,
@@ -1269,7 +1225,6 @@ func TestConfigMapUnpacker(t *testing.T) {
1269
1225
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
1270
1226
},
1271
1227
},
1272
- SecurityContext : expectedContainerSecurityContext ,
1273
1228
},
1274
1229
},
1275
1230
InitContainers : []corev1.Container {
@@ -1289,7 +1244,6 @@ func TestConfigMapUnpacker(t *testing.T) {
1289
1244
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
1290
1245
},
1291
1246
},
1292
- SecurityContext : expectedContainerSecurityContext ,
1293
1247
},
1294
1248
{
1295
1249
Name : "pull" ,
@@ -1312,7 +1266,6 @@ func TestConfigMapUnpacker(t *testing.T) {
1312
1266
corev1 .ResourceMemory : resource .MustParse ("50Mi" ),
1313
1267
},
1314
1268
},
1315
- SecurityContext : expectedContainerSecurityContext ,
1316
1269
},
1317
1270
},
1318
1271
Volumes : []corev1.Volume {
0 commit comments