Skip to content

Commit 18076ec

Browse files
committed
fix: test case should test for deisred 1 and not nil deployment
Signed-off-by: Sandor Szücs <[email protected]>
1 parent 7980179 commit 18076ec

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

pkg/core/stack_resources_test.go

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,19 +1213,18 @@ func TestStackGenerateService(t *testing.T) {
12131213

12141214
func TestStackGenerateDeployment(t *testing.T) {
12151215
for _, tc := range []struct {
1216-
name string
1217-
hpaEnabled bool
1218-
stackReplicas int32
1219-
minReadySeconds int32
1220-
prescalingActive bool
1221-
prescalingReplicas int32
1222-
deploymentReplicas int32
1223-
noTrafficSince time.Time
1224-
expectedReplicas int32
1225-
maxUnavailable int
1226-
maxSurge int
1227-
stackAnnotations map[string]string
1228-
expectedDeploymentNil bool
1216+
name string
1217+
hpaEnabled bool
1218+
stackReplicas int32
1219+
minReadySeconds int32
1220+
prescalingActive bool
1221+
prescalingReplicas int32
1222+
deploymentReplicas int32
1223+
noTrafficSince time.Time
1224+
expectedReplicas int32
1225+
maxUnavailable int
1226+
maxSurge int
1227+
stackAnnotations map[string]string
12291228
}{
12301229
{
12311230
name: "stack scaled down to zero, deployment still running",
@@ -1360,13 +1359,13 @@ func TestStackGenerateDeployment(t *testing.T) {
13601359
minReadySeconds: 5,
13611360
},
13621361
{
1363-
name: "cluster migration should scale down deployment",
1362+
name: "cluster migration should scale down deployment to 1",
13641363
stackReplicas: 3,
13651364
deploymentReplicas: 3,
13661365
stackAnnotations: map[string]string{
13671366
forwardBackendAnnotation: "fwd-deployment",
13681367
},
1369-
expectedDeploymentNil: true,
1368+
expectedReplicas: 1,
13701369
},
13711370
} {
13721371
t.Run(tc.name, func(t *testing.T) {
@@ -1428,10 +1427,6 @@ func TestStackGenerateDeployment(t *testing.T) {
14281427
}
14291428
}
14301429
deployment := c.GenerateDeployment()
1431-
if tc.expectedDeploymentNil {
1432-
require.Nil(t, deployment, "Failed to generate nil deployment")
1433-
return
1434-
}
14351430
expected := &apps.Deployment{
14361431
ObjectMeta: testResourceMeta,
14371432
Spec: apps.DeploymentSpec{

0 commit comments

Comments
 (0)