-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
good first issueGood for newcomersGood for newcomersrefactorRefactor with same functionalityRefactor with same functionality
Description
Description
Currently, metrics tests across the testsuite are inconsistent in how they query and filter Prometheus metrics — some use has_label(), others use raw lambdas, and some make individual prometheus.get_metrics() calls per test without a shared fixture.
The CoreDNS tests (testsuite/tests/multicluster/coredns/two_clusters/metrics/test_metrics.py) demonstrate the preferred pattern:
- Fetch all relevant metrics once in a module-scoped fixture
- Use
.filter(has_label(...))in individual tests to filter from the already-collected metrics
This approach reduces the number of Prometheus API calls and provides a consistent interface.
Files to review and refactor
testsuite/tests/singlecluster/limitador/metrics/test_metrics.pytestsuite/tests/singlecluster/limitador/metrics/trlp_metrics/test_trlp_metrics.pytestsuite/tests/singlecluster/limitador/metrics/trlp_metrics/test_trlp_metrics_stream.pytestsuite/tests/singlecluster/authorino/metrics/test_deep_metrics.py
Note: This list may not be exhaustive. Search the testsuite for other metrics test files that could benefit from the same refactoring.
Acceptance criteria
- All metrics tests use a shared module-scoped fixture for fetching metrics
- Filtering is done via
.filter(has_label(...))instead of passing labels toget_metrics()in each test - No change in test coverage or behavior
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersrefactorRefactor with same functionalityRefactor with same functionality
Type
Projects
Status
🆕 New