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

Promtool duplicates error message if multiple alertnames are evaluated at same time #4944

Closed
mwalters-workmarket opened this Issue Dec 3, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@mwalters-workmarket
Copy link

mwalters-workmarket commented Dec 3, 2018

Minimal example:

rules.yaml:

groups:
  - name: MyRules
    rules:
      - alert: AnAlert
        expr: abc{} > 2
        for: 1m
      - alert: AnotherAlert
        expr: def{} > 2

test.yaml:

rule_files:
  - rules.yaml
evaluation_interval: 1m
tests:
  - interval: 1m
    input_series:
      - series: 'abc{}'
        values: '1'
      - series: 'def{}'
        values: '3'
    alert_rule_test:
      - alertname: AnAlert
        eval_time: 1m
      - alertname: AnotherAlert
        eval_time: 1m

when I execute promtool test rules test.yaml
I expect to see output:

Unit Testing:  test.yaml
  FAILED:
    alertname:AnotherAlert, time:1m0s, 
        exp:"[]", 
        got:"[Labels:{alertname=\"AnotherAlert\"} Annotations:{}]"

But the actual output is:

Unit Testing:  test.yaml
  FAILED:
    alertname:AnotherAlert, time:1m0s, 
        exp:"[]", 
        got:"[Labels:{alertname=\"AnotherAlert\"} Annotations:{}]"
    alertname:AnotherAlert, time:1m0s, 
        exp:"[]", 
        got:"[Labels:{alertname=\"AnotherAlert\"} Annotations:{}]"

It looks like the issue is occurring because in the test file, the eval_time for both rules is the same (1m)

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Dec 3, 2018

@codesome

This comment has been minimized.

Copy link
Member

codesome commented Dec 4, 2018

Thanks @mwalters-workmarket for reporting this. Will look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.