Cleanup and fix E2E tests and metric emission#633
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request cleans up outdated end-to-end tests and fixes metric emission to use the VariantAutoscaling name instead of the scaleTargetRef (deployment) name. This change addresses issue #630, ensuring external metrics are correctly labeled with the VariantAutoscaling resource name for proper identification and HPA selector compatibility.
Changes:
- Modified metric emission in
internal/metrics/metrics.goto useva.Nameinstead ofva.GetScaleTargetName()for thevariant_namelabel - Updated test utility function
CreateVariantAutoscalingResourceto distinguish between VariantAutoscaling name and its scaleTargetRef deployment name - Removed outdated E2E test files (
test/e2e/e2e_test.goandtest/e2e/e2e_suite_test.go) - Updated all saturation-based E2E tests to use the new function signatures with separate VA and deployment names
- Updated unit tests to reflect the distinction between VariantAutoscaling name and deployment name
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/metrics/metrics.go | Changed metric emission to use VariantAutoscaling name for variant_name label, fixing issue #630 |
| test/utils/e2eutils.go | Added scaleTargetRefName parameter to CreateVariantAutoscalingResource function; removed obsolete commented code |
| test/e2e/e2e_test.go | Deleted outdated E2E test file (1546 lines removed) |
| test/e2e/e2e_suite_test.go | Deleted outdated E2E suite file (148 lines removed) |
| test/e2e-saturation-based/e2e_scale_to_zero_test.go | Updated to distinguish between VA name and deployment name in test setup and assertions |
| test/e2e-saturation-based/e2e_scale_from_zero_test.go | Updated to use separate VA and deployment names in CreateVariantAutoscalingResource calls |
| test/e2e-saturation-based/e2e_saturation_test.go | Updated single and multiple VA tests to properly distinguish VA names from deployment names |
| test/e2e-saturation-based/e2e_limiter_test.go | Updated limiter tests to use correct VA name for resource lookups |
| internal/engines/scalefromzero/engine_test.go | Updated unit tests to pass separate VA and deployment names to test utility functions |
|
Now, the limiter config in E2Es is properly checked by the controller, and constrained scale-out is checked, closing #635. |
|
After properly configuring the limiter tests, the CI tests for the |
0d50e7c to
da9878c
Compare
|
/ok-to-test |
|
🚀 E2E tests triggered by /ok-to-test |
da9878c to
2cd1e67
Compare
| err := k8sClient.CoreV1().ConfigMaps(controllerNamespace).Delete(ctx, scaleToZeroConfigMapName, metav1.DeleteOptions{}) | ||
| Expect(client.IgnoreNotFound(err)).NotTo(HaveOccurred(), fmt.Sprintf("Should be able to delete existing scale-to-zero ConfigMap: %s", scaleToZeroConfigMapName)) |
There was a problem hiding this comment.
The error handling has been improved by capturing and checking the error from the Delete operation. However, the comment on line 110 mentions "Delete existing ConfigMap if it exists", but the code doesn't actually ignore NotFound errors before the check. Consider using client.IgnoreNotFound(err) directly on line 112 instead of checking it separately, or remove the comment since the new implementation expects the ConfigMap to exist.
|
/ok-to-test |
|
🚀 E2E tests triggered by /ok-to-test |
|
/ok-to-test |
|
🚀 E2E tests triggered by /ok-to-test |
|
/ok-to-test |
|
🚀 E2E tests triggered by /ok-to-test |
…ame instead of Deployment
|
/ok-to-test |
|
🚀 E2E tests triggered by /ok-to-test |
|
@asm582 @lionelvillard FYI E2Es passed on this one, marked it ready for review. Thanks! |
Per title, this PR:
scaleTargetRefname.variant_name, instead of thescaleTargetRefname (closes External metrics should be labelled with VariantAutoscaling name #630).