Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU Scaler: Make CPU scaler test wait for metrics window #5294

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

jkyros
Copy link
Contributor

@jkyros jkyros commented Dec 16, 2023

The CPU scaler tests assume the default metrics-server window of 30s, so those testing on platforms with larger metrics windows (e.g. platforms using prometheus-adapter, which has a 5m default window) will fail the CPU scaler test because the metrics won't be ready by the time the test starts.

This:

  • Adds a helper that waits for either the metrics to show up in the HPA, or for some amount of time to pass, whichever happens first
  • Uses said helper to ensure that the metrics are ready before the CPU test starts testing scaling

Output looks like this when it runs:

helper.go:441: Waiting for deployment replicas to hit target. Deployment - cpu-test-deployment, Current  - 1, Target - 1
helper.go:414: Waiting up to 10m0s for HPA to populate metrics - 0s so far
helper.go:414: Waiting up to 10m0s for HPA to populate metrics - 5s so far
...
helper.go:414: Waiting up to 10m0s for HPA to populate metrics - 3m35s so far
helper.go:414: Waiting up to 10m0s for HPA to populate metrics - 3m40s so far
helper.go:423: HPA has metrics after 3m40.333531912s: [
      {
          "type": "Resource",
          "resource": {
              "name": "cpu",
              "current": {
                  "averageValue": "1m",
                  "averageUtilization": 0
              }
          }
      }
  ]
cpu_test.go:210: --- testing scale out ---

Checklist

@jkyros jkyros requested a review from a team as a code owner December 16, 2023 08:12
Copy link

Thank you for your contribution! 🙏 We will review your PR as soon as possible.

While you are waiting, make sure to:

Learn more about:

@JorTurFer
Copy link
Member

JorTurFer commented Dec 16, 2023

/run-e2e cpu
Update: You can check the progress here

CHANGELOG.md Outdated Show resolved Hide resolved
The CPU scaler test assumes a default metrics window of 30s, so those
testing on platforms where it is set to a larger value will potentially
fail the CPU scaler test because the metrics won't be ready by the time
the test starts.

This:
- Adds a helper that waits for either the metrics to show up in the
HPA, or for some amount of time to pass, whichever happens first
- Uses said helper to ensure that the metrics are ready before the CPU
test starts testing scaling

Signed-off-by: John Kyros <jkyros@redhat.com>
@zroubalik zroubalik merged commit 3b8e798 into kedacore:main Dec 18, 2023
18 of 19 checks passed
toniiiik pushed a commit to toniiiik/keda that referenced this pull request Jan 15, 2024
The CPU scaler test assumes a default metrics window of 30s, so those
testing on platforms where it is set to a larger value will potentially
fail the CPU scaler test because the metrics won't be ready by the time
the test starts.

This:
- Adds a helper that waits for either the metrics to show up in the
HPA, or for some amount of time to pass, whichever happens first
- Uses said helper to ensure that the metrics are ready before the CPU
test starts testing scaling

Signed-off-by: John Kyros <jkyros@redhat.com>
Signed-off-by: anton.lysina <alysina@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants