@@ -122,6 +122,9 @@ func TestDispatcher(t *testing.T) {
122
122
Volumes : []corev1.Volume {{Name : "x" }},
123
123
},
124
124
},
125
+ Strategy : appsv1.DeploymentStrategy {
126
+ Type : appsv1 .RollingUpdateDeploymentStrategyType ,
127
+ },
125
128
}},
126
129
},
127
130
{
@@ -144,6 +147,9 @@ func TestDispatcher(t *testing.T) {
144
147
Volumes : []corev1.Volume {{Name : "x" }},
145
148
},
146
149
},
150
+ Strategy : appsv1.DeploymentStrategy {
151
+ Type : appsv1 .RollingUpdateDeploymentStrategyType ,
152
+ },
147
153
}},
148
154
params : []runtime.Object {
149
155
& corev1.ConfigMap {
@@ -212,6 +218,9 @@ func TestDispatcher(t *testing.T) {
212
218
Volumes : []corev1.Volume {{Name : "x" }},
213
219
},
214
220
},
221
+ Strategy : appsv1.DeploymentStrategy {
222
+ Type : appsv1 .RollingUpdateDeploymentStrategyType ,
223
+ },
215
224
}},
216
225
},
217
226
{
@@ -233,6 +242,9 @@ func TestDispatcher(t *testing.T) {
233
242
Volumes : []corev1.Volume {{Name : "x" }},
234
243
},
235
244
},
245
+ Strategy : appsv1.DeploymentStrategy {
246
+ Type : appsv1 .RollingUpdateDeploymentStrategyType ,
247
+ },
236
248
}},
237
249
policyHooks : []generic.PolicyHook [* Policy , * PolicyBinding , PolicyEvaluator ]{
238
250
{
@@ -317,6 +329,9 @@ func TestDispatcher(t *testing.T) {
317
329
Volumes : []corev1.Volume {{Name : "x" }},
318
330
},
319
331
},
332
+ Strategy : appsv1.DeploymentStrategy {
333
+ Type : appsv1 .RollingUpdateDeploymentStrategyType ,
334
+ },
320
335
}},
321
336
},
322
337
{
@@ -338,6 +353,9 @@ func TestDispatcher(t *testing.T) {
338
353
Volumes : []corev1.Volume {{Name : "x" }},
339
354
},
340
355
},
356
+ Strategy : appsv1.DeploymentStrategy {
357
+ Type : appsv1 .RollingUpdateDeploymentStrategyType ,
358
+ },
341
359
}},
342
360
policyHooks : []generic.PolicyHook [* Policy , * PolicyBinding , PolicyEvaluator ]{
343
361
{
@@ -444,6 +462,9 @@ func TestDispatcher(t *testing.T) {
444
462
Volumes : []corev1.Volume {{Name : "x" }},
445
463
},
446
464
},
465
+ Strategy : appsv1.DeploymentStrategy {
466
+ Type : appsv1 .RollingUpdateDeploymentStrategyType ,
467
+ },
447
468
}},
448
469
},
449
470
{
@@ -466,6 +487,9 @@ func TestDispatcher(t *testing.T) {
466
487
Volumes : []corev1.Volume {{Name : "x" }},
467
488
},
468
489
},
490
+ Strategy : appsv1.DeploymentStrategy {
491
+ Type : appsv1 .RollingUpdateDeploymentStrategyType ,
492
+ },
469
493
}},
470
494
policyHooks : []generic.PolicyHook [* Policy , * PolicyBinding , PolicyEvaluator ]{
471
495
{
@@ -571,6 +595,9 @@ func TestDispatcher(t *testing.T) {
571
595
Volumes : []corev1.Volume {{Name : "x" }},
572
596
},
573
597
},
598
+ Strategy : appsv1.DeploymentStrategy {
599
+ Type : appsv1 .RollingUpdateDeploymentStrategyType ,
600
+ },
574
601
}},
575
602
},
576
603
}
@@ -597,6 +624,11 @@ func TestDispatcher(t *testing.T) {
597
624
t .Fatal (err )
598
625
}
599
626
627
+ // Register a fake defaulter since registering the full defaulter adds noise
628
+ // and creates dep cycles.
629
+ scheme .AddTypeDefaultingFunc (& appsv1.Deployment {},
630
+ func (obj interface {}) { fakeSetDefaultForDeployment (obj .(* appsv1.Deployment )) })
631
+
600
632
objectInterfaces := admission .NewObjectInterfacesFromScheme (scheme )
601
633
602
634
for _ , tc := range testCases {
@@ -673,3 +705,11 @@ func (t testParamScope) Name() meta.RESTScopeName {
673
705
}
674
706
675
707
var _ meta.RESTScope = testParamScope {}
708
+
709
+ func fakeSetDefaultForDeployment (obj * appsv1.Deployment ) {
710
+ // Just default strategy type so the tests have a defaulted field to observe
711
+ strategy := & obj .Spec .Strategy
712
+ if strategy .Type == "" {
713
+ strategy .Type = appsv1 .RollingUpdateDeploymentStrategyType
714
+ }
715
+ }
0 commit comments