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

Add human-readable eval_time to rules unit tests #7681

Closed
kustodian opened this issue Jul 28, 2020 · 2 comments
Closed

Add human-readable eval_time to rules unit tests #7681

kustodian opened this issue Jul 28, 2020 · 2 comments

Comments

@kustodian
Copy link

Proposal

Rules unit tests would be much easier to read if the eval_time supported human-readable times like this:

    alert_rule_test:
        # Alert should not be triggered after 3h and 59m
      - eval_time: 3h59m  # instead of 239m
        alertname: postgres_invalid_indices
        exp_alerts: []

        # Alert should not be triggered after 4h and 6m (because of staleness)
      - eval_time: 4h6m  # instead of 246m
        alertname: postgres_invalid_indices
        exp_alerts: []

If something needs to be triggered after 4 hours and if we want to test will it be triggered at 3 hours and 59 minutes, it's easier to read 3h59m, then 239m. Samo goes for 4h6m instead of 246m.

@rudo-thomas
Copy link

Durations like 3h59m used to be supported before 2.20.0, see this PR (found through the 2.20.0 release notes).

@roidelapluie
Copy link
Member

We now support them again: #7713 . Note that we do not support non-integers (1.5h).

@prometheus prometheus locked as resolved and limited conversation to collaborators Nov 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants