@@ -87,6 +87,28 @@ func TestKustomizeDeploy(t *testing.T) {
87
87
},
88
88
forceDeploy : true ,
89
89
},
90
+ {
91
+ description : "built-in kubectl kustomize with newer version" ,
92
+ cfg : & latest.KustomizeDeploy {
93
+ KustomizePaths : []string {"a" , "b" },
94
+ },
95
+ commands : testutil .
96
+ CmdRunOut ("kubectl version --client -ojson" , kubectlVersion118 ).
97
+ AndRunOut ("kubectl --context kubecontext --namespace testNamespace kustomize a" , deploymentWebYAML ).
98
+ AndRunOut ("kubectl --context kubecontext --namespace testNamespace kustomize b" , deploymentAppYAML ).
99
+ AndRun ("kubectl --context kubecontext --namespace testNamespace apply -f - --force --grace-period=0" ),
100
+ builds : []build.Artifact {
101
+ {
102
+ ImageName : "leeroy-web" ,
103
+ Tag : "leeroy-web:123" ,
104
+ },
105
+ {
106
+ ImageName : "leeroy-app" ,
107
+ Tag : "leeroy-app:123" ,
108
+ },
109
+ },
110
+ forceDeploy : true ,
111
+ },
90
112
}
91
113
for _ , test := range tests {
92
114
testutil .Run (t , test .description , func (t * testutil.T ) {
@@ -131,7 +153,8 @@ func TestKustomizeCleanup(t *testing.T) {
131
153
KustomizePaths : []string {tmpDir .Root ()},
132
154
},
133
155
commands : testutil .
134
- CmdRunOut ("kustomize build " + tmpDir .Root (), deploymentWebYAML ).
156
+ CmdRunOut ("kubectl version --client -ojson" , kubectlVersion112 ).
157
+ AndRunOut ("kustomize build " + tmpDir .Root (), deploymentWebYAML ).
135
158
AndRun ("kubectl --context kubecontext --namespace testNamespace delete --ignore-not-found=true -f -" ),
136
159
},
137
160
{
@@ -140,7 +163,8 @@ func TestKustomizeCleanup(t *testing.T) {
140
163
KustomizePaths : tmpDir .Paths ("a" , "b" ),
141
164
},
142
165
commands : testutil .
143
- CmdRunOut ("kustomize build " + tmpDir .Path ("a" ), deploymentWebYAML ).
166
+ CmdRunOut ("kubectl version --client -ojson" , kubectlVersion112 ).
167
+ AndRunOut ("kustomize build " + tmpDir .Path ("a" ), deploymentWebYAML ).
144
168
AndRunOut ("kustomize build " + tmpDir .Path ("b" ), deploymentAppYAML ).
145
169
AndRun ("kubectl --context kubecontext --namespace testNamespace delete --ignore-not-found=true -f -" ),
146
170
},
@@ -150,7 +174,8 @@ func TestKustomizeCleanup(t *testing.T) {
150
174
KustomizePaths : []string {tmpDir .Root ()},
151
175
},
152
176
commands : testutil .
153
- CmdRunOut ("kustomize build " + tmpDir .Root (), deploymentWebYAML ).
177
+ CmdRunOut ("kubectl version --client -ojson" , kubectlVersion112 ).
178
+ AndRunOut ("kustomize build " + tmpDir .Root (), deploymentWebYAML ).
154
179
AndRunErr ("kubectl --context kubecontext --namespace testNamespace delete --ignore-not-found=true -f -" , errors .New ("BUG" )),
155
180
shouldErr : true ,
156
181
},
@@ -159,11 +184,9 @@ func TestKustomizeCleanup(t *testing.T) {
159
184
cfg : & latest.KustomizeDeploy {
160
185
KustomizePaths : []string {tmpDir .Root ()},
161
186
},
162
- commands : testutil .CmdRunOutErr (
163
- "kustomize build " + tmpDir .Root (),
164
- "" ,
165
- errors .New ("BUG" ),
166
- ),
187
+ commands : testutil .
188
+ CmdRunOut ("kubectl version --client -ojson" , kubectlVersion112 ).
189
+ AndRunOutErr ("kustomize build " + tmpDir .Root (), "" , errors .New ("BUG" )),
167
190
shouldErr : true ,
168
191
},
169
192
}
@@ -399,49 +422,49 @@ func TestKustomizeBuildCommandArgs(t *testing.T) {
399
422
description : "no BuildArgs, empty KustomizePaths " ,
400
423
buildArgs : []string {},
401
424
kustomizePath : "" ,
402
- expectedArgs : [] string { "build" } ,
425
+ expectedArgs : nil ,
403
426
},
404
427
{
405
428
description : "One BuildArg, empty KustomizePaths" ,
406
429
buildArgs : []string {"--foo" },
407
430
kustomizePath : "" ,
408
- expectedArgs : []string {"build" , " --foo" },
431
+ expectedArgs : []string {"--foo" },
409
432
},
410
433
{
411
434
description : "no BuildArgs, non-empty KustomizePaths" ,
412
435
buildArgs : []string {},
413
436
kustomizePath : "foo" ,
414
- expectedArgs : []string {"build" , " foo" },
437
+ expectedArgs : []string {"foo" },
415
438
},
416
439
{
417
440
description : "One BuildArg, non-empty KustomizePaths" ,
418
441
buildArgs : []string {"--foo" },
419
442
kustomizePath : "bar" ,
420
- expectedArgs : []string {"build" , " --foo" , "bar" },
443
+ expectedArgs : []string {"--foo" , "bar" },
421
444
},
422
445
{
423
446
description : "Multiple BuildArg, empty KustomizePaths" ,
424
447
buildArgs : []string {"--foo" , "--bar" },
425
448
kustomizePath : "" ,
426
- expectedArgs : []string {"build" , " --foo" , "--bar" },
449
+ expectedArgs : []string {"--foo" , "--bar" },
427
450
},
428
451
{
429
452
description : "Multiple BuildArg with spaces, empty KustomizePaths" ,
430
453
buildArgs : []string {"--foo bar" , "--baz" },
431
454
kustomizePath : "" ,
432
- expectedArgs : []string {"build" , " --foo" , "bar" , "--baz" },
455
+ expectedArgs : []string {"--foo" , "bar" , "--baz" },
433
456
},
434
457
{
435
458
description : "Multiple BuildArg with spaces, non-empty KustomizePaths" ,
436
459
buildArgs : []string {"--foo bar" , "--baz" },
437
460
kustomizePath : "barfoo" ,
438
- expectedArgs : []string {"build" , " --foo" , "bar" , "--baz" , "barfoo" },
461
+ expectedArgs : []string {"--foo" , "bar" , "--baz" , "barfoo" },
439
462
},
440
463
{
441
464
description : "Multiple BuildArg no spaces, non-empty KustomizePaths" ,
442
465
buildArgs : []string {"--foo" , "bar" , "--baz" },
443
466
kustomizePath : "barfoo" ,
444
- expectedArgs : []string {"build" , " --foo" , "bar" , "--baz" , "barfoo" },
467
+ expectedArgs : []string {"--foo" , "bar" , "--baz" , "barfoo" },
445
468
},
446
469
}
447
470
0 commit comments