Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions promql/promql-test-queries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,22 @@ test_cases:
# TODO: Add tests for staleness support.
- query: 'demo_memory_usage_bytes'
- query: '{__name__="demo_memory_usage_bytes"}'
# Check for spacing.
- query: ' { __name__ = "demo_memory_usage_bytes" } '
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe put this into the lower section where we have multiple matchers, and have spaces around the comma as well?

- query: 'demo_memory_usage_bytes{type="free"}'
- query: 'demo_memory_usage_bytes{type=`free`}'
- query: "demo_memory_usage_bytes{type='free'}"
- query: 'demo_memory_usage_bytes{type!="free"}'
- query: 'demo_memory_usage_bytes{instance=~"demo.promlabs.com:.*"}'
# Check for anchored regexes.
- query: 'demo_memory_usage_bytes{instance=~"demo.promlabs.com"}'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I see it, probably for good measure we should escape the dots here and in the existing query above :)

- query: 'demo_memory_usage_bytes{instance=~"host"}'
- query: 'demo_memory_usage_bytes{instance!~".*:10000"}'
- query: 'demo_memory_usage_bytes{type="free", instance!="demo.promlabs.com:10000"}'
- query: '{type="free", instance!="demo.promlabs.com:10000"}'
# Check for using the same label name in different matchers.
- query: '{__name__=~"go_gc_heap_allocs.*",__name__=~".*_sum"}'
- query: '{type="free",type!="free"}'
- query: '{__name__=~".*"}'
should_fail: true
- query: "nonexistent_metric_name"
Expand Down