@@ -1161,18 +1161,19 @@ func TestStackGenerateService(t *testing.T) {
11611161
11621162func TestStackGenerateDeployment (t * testing.T ) {
11631163 for _ , tc := range []struct {
1164- name string
1165- hpaEnabled bool
1166- stackReplicas int32
1167- minReadySeconds int32
1168- prescalingActive bool
1169- prescalingReplicas int32
1170- deploymentReplicas int32
1171- noTrafficSince time.Time
1172- expectedReplicas int32
1173- maxUnavailable int
1174- maxSurge int
1175- stackAnnotations map [string ]string
1164+ name string
1165+ hpaEnabled bool
1166+ stackReplicas int32
1167+ minReadySeconds int32
1168+ prescalingActive bool
1169+ prescalingReplicas int32
1170+ deploymentReplicas int32
1171+ noTrafficSince time.Time
1172+ expectedReplicas int32
1173+ maxUnavailable int
1174+ maxSurge int
1175+ stackAnnotations map [string ]string
1176+ expectedDeploymentNil bool
11761177 }{
11771178 {
11781179 name : "stack scaled down to zero, deployment still running" ,
@@ -1310,10 +1311,10 @@ func TestStackGenerateDeployment(t *testing.T) {
13101311 name : "cluster migration should scale down deployment" ,
13111312 stackReplicas : 3 ,
13121313 deploymentReplicas : 3 ,
1313- expectedReplicas : 1 ,
13141314 stackAnnotations : map [string ]string {
13151315 forwardBackendAnnotation : "fwd-deployment" ,
13161316 },
1317+ expectedDeploymentNil : true ,
13171318 },
13181319 } {
13191320 t .Run (tc .name , func (t * testing.T ) {
@@ -1375,6 +1376,10 @@ func TestStackGenerateDeployment(t *testing.T) {
13751376 }
13761377 }
13771378 deployment := c .GenerateDeployment ()
1379+ if tc .expectedDeploymentNil {
1380+ require .Nil (t , deployment , "Failed to generate nil deployment" )
1381+ return
1382+ }
13781383 expected := & apps.Deployment {
13791384 ObjectMeta : testResourceMeta ,
13801385 Spec : apps.DeploymentSpec {
@@ -1517,9 +1522,7 @@ func TestGenerateHPA(t *testing.T) {
15171522 },
15181523 },
15191524 },
1520- expectedBehavior : exampleBehavior ,
1521- expectedMinReplicas : & min ,
1522- expectedMaxReplicas : 1 ,
1525+ expectedBehavior : nil ,
15231526 },
15241527 } {
15251528 t .Run (tc .name , func (t * testing.T ) {
0 commit comments