Repository navigation
Description
Problem Description
One case of the test row takes more time than any other test: tests/prometheus/test_k8s_monitoring_alerting.py::test_each_unit_tested_rule_fires_on_a_sample_and_stays_quiet_on_a_normal_series[roadmap-service-activity]. It runs promtool test rules on tests/fixtures/prometheus_rules/roadmap_service_activity_tests.yaml.
That file sets evaluation_interval: 1m. Seven of its 16 test groups use interval: 1h series and an eval_time of 150 h or 200 h, for the alert RoadmapServiceAlternativesNotSearching (ranges of 3 d and 7 d, added by #3870 on 2026-11-07). promtool evaluates every rule of the group at each evaluation interval from 0 to the last eval_time of a test group. Thus each of these groups makes 9,000 to 12,000 evaluation rounds of the 4 rules of the group.
The other files with hour-scale cases already set evaluation_interval: 1h: research_tests.yaml, roadmap_service_tools_tests.yaml and ai_spend_tests.yaml.
With --dist worksteal, the local test row cannot end before its slowest test, so this one case puts a floor under the test row. In CI it is the slowest test of its shard.
Reproduction Steps
- Run
uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k "test_each_unit_tested_rule and activity" -n0 --durations=5. - Read the time of the
[roadmap-service-activity]case.
Expected vs Actual Behavior
Expected: each promtool case takes a few seconds, as the cases of the other groups do.
Actual:
| Where | Time of the case |
|---|---|
GitHub runner, shard 3 of run 42938256840 on main (2026-11-11) |
63.8 s |
| Local gate logs of the last 5 days, 24 runs under load | median 147 s, max 263 s |
promtool test rules on the file as it is (local, load 40 to 75) |
166 s CPU |
The same 16 groups split in two files, 1m and 1h |
6.7 s CPU together |
Both split files pass with SUCCESS.
Proposed fix
- Move the 7 hour-scale test groups to a new file
tests/fixtures/prometheus_rules/roadmap_service_activity_hourly_tests.yamlwithevaluation_interval: 1h. Keep the minute-scale groups in the old file. - Let one rule group have more than one promtool test file. Each file tests only alerts of its group, and the files of a group together test every alert of the group.
- Add a guard test: no promtool test group evaluates more than a fixed number of rounds (its last
eval_timedivided by theevaluation_intervalof its file). The guard reads the durations with the existingdevops_cli.prometheus.client.parse_duration. It fails on the file as it is (12,000 rounds) and passes after the split.
The fix changes only tests and test fixtures. It does not change k8s/monitoring/prometheus-values.yaml.
Environment Diagnostics
Devcontainer on WSL2, 16 CPUs, promtool 3.15.1. CI installs the pinned promtool in each test shard (Install promtool step of ci.yml).
Logs, Traces, or Terminal Output
Found by the measurement of #4405. Related: #4250 balances the shards by measured time; this fix removes the slowest single test.
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
perfprefix of the title gives the type.test, and .github/labels.yml declares no scope/test label. Add the label to the file to give the scope to this item.It removes the slowest single test from the CI row but does not block any release.It removes a 160-second floor under the test row and the slowest test in CI.It requires splitting a fixture file, updating test code for multi-file groups, and adding a guard test.Both reduce CI test time, but #4250 balances shard assignments while the candidate shortens one specific test by splitting its fixture file.devops-cli-service commentedon Nov 11, 2026
Released in v0.111.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.111.0
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 05:46 UTC