promtool test rules is useless for simple expressions tests #9758
Unanswered
piotrminkina
asked this question in
Q&A
Replies: 2 comments
-
Hello, The two first queries do not return series, so you have to provide an empty list to exp_samples. The last 4 queries uses idelta, which drops the metric name, so you have to omit it as well. Regards, evaluation_interval: 15s
tests:
- interval: 15s
input_series:
- series: metric
values: '_ 0 1 1 2 3 5 8'
promql_expr_test:
- expr: 'idelta(metric[30s])'
eval_time: '0s'
exp_samples: []
- expr: 'idelta(metric[30s])'
eval_time: '15s'
exp_samples: []
- expr: 'idelta(metric[30s])'
eval_time: 30s
exp_samples:
- labels: ''
value: 1
- expr: 'idelta(metric[30s])'
eval_time: 45s
exp_samples:
- labels: ''
value: 0
- expr: 'idelta(metric[30s])'
eval_time: 1m
exp_samples:
- labels: ''
value: 1
- expr: 'idelta(metric[30s])'
eval_time: 1m15s
exp_samples:
- labels: ''
value: 1 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Wow! Thank you for your reply. This is my first time sitting down to test Prometheus rules and I wasn't aware of such nuances. Thank you so much for your help! Regards |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying test the following YAML file by command
./promtool test rules nil.yaml
:I expect all test cases to be successful, but instead no test case is correct (same results for older promtool in version
2.29.1
).Environment
$ ./promtool --version promtool, version 2.31.1 (branch: HEAD, revision: 411021ada9ab41095923b8d2df9365b632fd40c3) build user: root@9419c9c2d4e0 build date: 20211105-20:35:02 go version: go1.17.3 platform: linux/amd64 # And also I'm using another version, installed globally $ promtool --version promtool, version 2.29.1 (branch: HEAD, revision: dcb07e8eac34b5ea37cd229545000b857f1c1637) build user: root@364730518a4e build date: 20210811-14:48:27 go version: go1.16.7 platform: linux/amd64
Beta Was this translation helpful? Give feedback.
All reactions