Skip to content

Commit

Permalink
fix: stop scale loop for pause Scaledbject (issue kedacore#4253). spe…
Browse files Browse the repository at this point in the history
…ed up test with slim container image and wait for monitored deployment

Signed-off-by: Tobo Atchou <[email protected]>
  • Loading branch information
tobotg committed Jun 14, 2023
1 parent 7039451 commit fc3dad7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/internals/pause_scaling/pause_scaling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
spec:
containers:
- name: {{.MonitoredDeploymentName}}
image: nginxinc/nginx-unprivileged
image: nginxinc/nginx-unprivileged:alpine-slim
`

deploymentTemplate = `
Expand All @@ -83,7 +83,7 @@ spec:
spec:
containers:
- name: {{.DeploymentName}}
image: nginxinc/nginx-unprivileged
image: nginxinc/nginx-unprivileged:alpine-slim
`

scaledObjectTemplate = `
Expand Down Expand Up @@ -170,6 +170,8 @@ func getTemplateData() (templateData, []Template) {
func testPauseAt0(t *testing.T, kc *kubernetes.Clientset) {
t.Log("--- testing pausing at 0 ---")
KubernetesScaleDeployment(t, kc, monitoredDeploymentName, 2, testNamespace)
assert.Truef(t, WaitForDeploymentReplicaReadyCount(t, kc, monitoredDeploymentName, testNamespace, 2, 60, testScaleOutWaitMin),
"monitoredDeploymentName replica count should be 2 after %d minute(s)", testScaleOutWaitMin)

AssertReplicaCountNotChangeDuringTimePeriod(t, kc, deploymentName, testNamespace, 0, 60)
}
Expand All @@ -189,6 +191,9 @@ func testPauseAtN(t *testing.T, kc *kubernetes.Clientset, data templateData, n i

KubernetesScaleDeployment(t, kc, monitoredDeploymentName, 0, testNamespace)

assert.Truef(t, WaitForDeploymentReplicaReadyCount(t, kc, monitoredDeploymentName, testNamespace, 0, 60, testPauseAtNWaitMin),
"monitoredDeploymentName replica count should be 0 after %d minute(s)", testPauseAtNWaitMin)

assert.Truef(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, n, 60, testPauseAtNWaitMin),
"replica count should be %d after %d minute(s)", n, testPauseAtNWaitMin)
}
Expand Down

0 comments on commit fc3dad7

Please sign in to comment.