@@ -463,9 +463,7 @@ func Test_makeVolumeMountPatch(t *testing.T) {
463
463
args args
464
464
wantPath string
465
465
wantName string
466
- wantErr bool
467
466
inputParams map [string ]* structpb.Value
468
- errMsg string
469
467
}{
470
468
{
471
469
"pvc name: constant (deprecated)" ,
@@ -481,9 +479,7 @@ func Test_makeVolumeMountPatch(t *testing.T) {
481
479
},
482
480
"/mnt/path" ,
483
481
"pvc-name" ,
484
- false ,
485
482
nil ,
486
- "" ,
487
483
},
488
484
{
489
485
"pvc name: constant parameter" ,
@@ -500,9 +496,7 @@ func Test_makeVolumeMountPatch(t *testing.T) {
500
496
},
501
497
"/mnt/path" ,
502
498
"pvc-name" ,
503
- false ,
504
499
nil ,
505
- "" ,
506
500
},
507
501
{
508
502
"pvc name: component input parameter" ,
@@ -518,11 +512,9 @@ func Test_makeVolumeMountPatch(t *testing.T) {
518
512
},
519
513
"/mnt/path" ,
520
514
"pvc-name" ,
521
- false ,
522
515
map [string ]* structpb.Value {
523
516
"param_1" : structpb .NewStringValue ("pvc-name" ),
524
517
},
525
- "" ,
526
518
},
527
519
}
528
520
@@ -537,20 +529,13 @@ func Test_makeVolumeMountPatch(t *testing.T) {
537
529
nil ,
538
530
tt .inputParams ,
539
531
)
540
- if tt .wantErr {
541
- assert .NotNil (t , err )
542
- assert .Nil (t , volumeMounts )
543
- assert .Nil (t , volumes )
544
- assert .Contains (t , err .Error (), tt .errMsg )
545
- } else {
546
- assert .Nil (t , err )
547
- assert .Equal (t , 1 , len (volumeMounts ))
548
- assert .Equal (t , 1 , len (volumes ))
549
- assert .Equal (t , volumeMounts [0 ].MountPath , tt .wantPath )
550
- assert .Equal (t , volumeMounts [0 ].Name , tt .wantName )
551
- assert .Equal (t , volumes [0 ].Name , tt .wantName )
552
- assert .Equal (t , volumes [0 ].PersistentVolumeClaim .ClaimName , tt .wantName )
553
- }
532
+ assert .Nil (t , err )
533
+ assert .Equal (t , 1 , len (volumeMounts ))
534
+ assert .Equal (t , 1 , len (volumes ))
535
+ assert .Equal (t , volumeMounts [0 ].MountPath , tt .wantPath )
536
+ assert .Equal (t , volumeMounts [0 ].Name , tt .wantName )
537
+ assert .Equal (t , volumes [0 ].Name , tt .wantName )
538
+ assert .Equal (t , volumes [0 ].PersistentVolumeClaim .ClaimName , tt .wantName )
554
539
})
555
540
}
556
541
}
@@ -1071,9 +1056,9 @@ func Test_extendPodSpecPatch_Secret(t *testing.T) {
1071
1056
Name : "SECRET_VAR" ,
1072
1057
ValueFrom : & k8score.EnvVarSource {
1073
1058
SecretKeyRef : & k8score.SecretKeySelector {
1074
- k8score.LocalObjectReference {Name : "my-secret" },
1075
- "password" ,
1076
- nil ,
1059
+ LocalObjectReference : k8score.LocalObjectReference {Name : "my-secret" },
1060
+ Key : "password" ,
1061
+ Optional : nil ,
1077
1062
},
1078
1063
},
1079
1064
},
@@ -1115,9 +1100,9 @@ func Test_extendPodSpecPatch_Secret(t *testing.T) {
1115
1100
Name : "SECRET_VAR" ,
1116
1101
ValueFrom : & k8score.EnvVarSource {
1117
1102
SecretKeyRef : & k8score.SecretKeySelector {
1118
- k8score.LocalObjectReference {Name : "my-secret" },
1119
- "password" ,
1120
- nil ,
1103
+ LocalObjectReference : k8score.LocalObjectReference {Name : "my-secret" },
1104
+ Key : "password" ,
1105
+ Optional : nil ,
1121
1106
},
1122
1107
},
1123
1108
},
@@ -1158,9 +1143,9 @@ func Test_extendPodSpecPatch_Secret(t *testing.T) {
1158
1143
Name : "SECRET_VAR" ,
1159
1144
ValueFrom : & k8score.EnvVarSource {
1160
1145
SecretKeyRef : & k8score.SecretKeySelector {
1161
- k8score.LocalObjectReference {Name : "secret-name" },
1162
- "password" ,
1163
- nil ,
1146
+ LocalObjectReference : k8score.LocalObjectReference {Name : "secret-name" },
1147
+ Key : "password" ,
1148
+ Optional : nil ,
1164
1149
},
1165
1150
},
1166
1151
},
@@ -1472,9 +1457,9 @@ func Test_extendPodSpecPatch_ConfigMap(t *testing.T) {
1472
1457
Name : "CONFIG_MAP_VAR" ,
1473
1458
ValueFrom : & k8score.EnvVarSource {
1474
1459
ConfigMapKeyRef : & k8score.ConfigMapKeySelector {
1475
- k8score.LocalObjectReference {Name : "my-cm" },
1476
- "foo" ,
1477
- nil ,
1460
+ LocalObjectReference : k8score.LocalObjectReference {Name : "my-cm" },
1461
+ Key : "foo" ,
1462
+ Optional : nil ,
1478
1463
},
1479
1464
},
1480
1465
},
@@ -1516,9 +1501,9 @@ func Test_extendPodSpecPatch_ConfigMap(t *testing.T) {
1516
1501
Name : "CONFIG_MAP_VAR" ,
1517
1502
ValueFrom : & k8score.EnvVarSource {
1518
1503
ConfigMapKeyRef : & k8score.ConfigMapKeySelector {
1519
- k8score.LocalObjectReference {Name : "my-cm" },
1520
- "foo" ,
1521
- nil ,
1504
+ LocalObjectReference : k8score.LocalObjectReference {Name : "my-cm" },
1505
+ Key : "foo" ,
1506
+ Optional : nil ,
1522
1507
},
1523
1508
},
1524
1509
},
@@ -1560,9 +1545,9 @@ func Test_extendPodSpecPatch_ConfigMap(t *testing.T) {
1560
1545
Name : "CONFIG_MAP_VAR" ,
1561
1546
ValueFrom : & k8score.EnvVarSource {
1562
1547
ConfigMapKeyRef : & k8score.ConfigMapKeySelector {
1563
- k8score.LocalObjectReference {Name : "cm-name" },
1564
- "foo" ,
1565
- nil ,
1548
+ LocalObjectReference : k8score.LocalObjectReference {Name : "cm-name" },
1549
+ Key : "foo" ,
1550
+ Optional : nil ,
1566
1551
},
1567
1552
},
1568
1553
},
@@ -2173,9 +2158,9 @@ func Test_extendPodSpecPatch_FieldPathAsEnv(t *testing.T) {
2173
2158
Name : "SECRET_VAR" ,
2174
2159
ValueFrom : & k8score.EnvVarSource {
2175
2160
SecretKeyRef : & k8score.SecretKeySelector {
2176
- k8score.LocalObjectReference {Name : "my-secret" },
2177
- "password" ,
2178
- nil ,
2161
+ LocalObjectReference : k8score.LocalObjectReference {Name : "my-secret" },
2162
+ Key : "password" ,
2163
+ Optional : nil ,
2179
2164
},
2180
2165
},
2181
2166
},
0 commit comments