Skip to content

Commit

Permalink
Add time.Sleep between creating and deleting wrong scaled resources
Browse files Browse the repository at this point in the history
Signed-off-by: Yoon Park <yoongon.park@gmail.com>
  • Loading branch information
yoongon committed Jan 13, 2024
1 parent 51b3234 commit 44ffcae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ func testScaledJobErrors(t *testing.T, data templateData) {
t.Log("--- testing scaled job errors ---")

KubectlDeleteWithTemplate(t, data, "scaledJobTemplate", scaledJobTemplate)
time.Sleep(2 * time.Second)
KubectlApplyWithTemplate(t, data, "wrongScaledJobTemplate", wrongScaledJobTemplate)

time.Sleep(20 * time.Second)
Expand All @@ -588,6 +589,7 @@ func testScaledJobErrors(t *testing.T, data templateData) {
}

KubectlDeleteWithTemplate(t, data, "wrongScaledJobTemplate", wrongScaledJobTemplate)
time.Sleep(2 * time.Second)
KubectlApplyWithTemplate(t, data, "scaledJobTemplate", scaledJobTemplate)
// wait for 10 seconds to correctly fetch metrics.
time.Sleep(10 * time.Second)
Expand All @@ -601,6 +603,7 @@ func testScalerErrors(t *testing.T, data templateData) {
KubectlApplyWithTemplate(t, data, "wrongScaledObjectTemplate", wrongScaledObjectTemplate)

KubectlDeleteWithTemplate(t, data, "scaledJobTemplate", scaledJobTemplate)
time.Sleep(2 * time.Second)
KubectlApplyWithTemplate(t, data, "wrongScaledJobTemplate", wrongScaledJobTemplate)

time.Sleep(15 * time.Second)
Expand All @@ -625,6 +628,7 @@ func testScalerErrors(t *testing.T, data templateData) {
}

KubectlDeleteWithTemplate(t, data, "wrongScaledJobTemplate", wrongScaledJobTemplate)
time.Sleep(2 * time.Second)
KubectlApplyWithTemplate(t, data, "scaledJobTemplate", scaledJobTemplate)

KubectlDeleteWithTemplate(t, data, "wrongScaledObjectTemplate", wrongScaledObjectTemplate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ func testScaledJobErrors(t *testing.T, data templateData) {
t.Log("--- testing scaled job errors ---")

KubectlDeleteWithTemplate(t, data, "scaledJobTemplate", scaledJobTemplate)
time.Sleep(2 * time.Second)
KubectlApplyWithTemplate(t, data, "wrongScaledJobTemplate", wrongScaledJobTemplate)

// wait for 2 seconds as pollinginterval is 2
Expand All @@ -585,6 +586,7 @@ func testScaledJobErrors(t *testing.T, data templateData) {
}

KubectlDeleteWithTemplate(t, data, "wrongScaledJobTemplate", wrongScaledJobTemplate)
time.Sleep(2 * time.Second)
KubectlApplyWithTemplate(t, data, "scaledJobTemplate", scaledJobTemplate)
}

Expand All @@ -596,6 +598,7 @@ func testScalerErrors(t *testing.T, data templateData) {
KubectlApplyWithTemplate(t, data, "wrongScaledObjectTemplate", wrongScaledObjectTemplate)

KubectlDeleteWithTemplate(t, data, "scaledJobTemplate", scaledJobTemplate)
time.Sleep(2 * time.Second)
KubectlApplyWithTemplate(t, data, "wrongScaledJobTemplate", wrongScaledJobTemplate)

family := fetchAndParsePrometheusMetrics(t, fmt.Sprintf("curl --insecure %s", kedaOperatorPrometheusURL))
Expand All @@ -617,6 +620,7 @@ func testScalerErrors(t *testing.T, data templateData) {
}
}
KubectlDeleteWithTemplate(t, data, "wrongScaledJobTemplate", wrongScaledJobTemplate)
time.Sleep(2 * time.Second)
KubectlApplyWithTemplate(t, data, "scaledJobTemplate", scaledJobTemplate)

KubectlDeleteWithTemplate(t, data, "wrongScaledObjectTemplate", wrongScaledObjectTemplate)
Expand Down

0 comments on commit 44ffcae

Please sign in to comment.