mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-19 06:33:06 -03:00
Reorganize tests into a real spec suite
This commit is contained in:
35
spec/tests/promql/test_complex_exp_single_quotes.txt
Normal file
35
spec/tests/promql/test_complex_exp_single_quotes.txt
Normal file
@ -0,0 +1,35 @@
|
||||
---input---
|
||||
(sum(rate(metric_test_app{app='turtle',proc='web'}[2m])) by(node))
|
||||
|
||||
---tokens---
|
||||
'(' Operator
|
||||
'sum' Keyword
|
||||
'(' Operator
|
||||
'rate' Keyword.Reserved
|
||||
'(' Operator
|
||||
'metric_test_app' Name.Variable
|
||||
'{' Punctuation
|
||||
'app' Name.Label
|
||||
'=' Operator
|
||||
"'" Punctuation
|
||||
'turtle' Literal.String
|
||||
"'" Punctuation
|
||||
',' Punctuation
|
||||
'proc' Name.Label
|
||||
'=' Operator
|
||||
"'" Punctuation
|
||||
'web' Literal.String
|
||||
"'" Punctuation
|
||||
'}' Punctuation
|
||||
'[' Punctuation
|
||||
'2m' Literal.String
|
||||
']' Punctuation
|
||||
')' Operator
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'by' Keyword
|
||||
'(' Operator
|
||||
'node' Name.Variable
|
||||
')' Operator
|
||||
')' Operator
|
||||
'\n' Text.Whitespace
|
15
spec/tests/promql/test_expression_and_comment.txt
Normal file
15
spec/tests/promql/test_expression_and_comment.txt
Normal file
@ -0,0 +1,15 @@
|
||||
---input---
|
||||
go_gc_duration_seconds{instance="localhost:9090"} # single comment
|
||||
|
||||
---tokens---
|
||||
'go_gc_duration_seconds' Name.Variable
|
||||
'{' Punctuation
|
||||
'instance' Name.Label
|
||||
'=' Operator
|
||||
'"' Punctuation
|
||||
'localhost:9090' Literal.String
|
||||
'"' Punctuation
|
||||
'}' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'# single comment' Comment.Single
|
||||
'\n' Text.Whitespace
|
19
spec/tests/promql/test_function_delta.txt
Normal file
19
spec/tests/promql/test_function_delta.txt
Normal file
@ -0,0 +1,19 @@
|
||||
---input---
|
||||
delta(cpu_temp_celsius{host="zeus"}[2h])
|
||||
|
||||
---tokens---
|
||||
'delta' Keyword.Reserved
|
||||
'(' Operator
|
||||
'cpu_temp_celsius' Name.Variable
|
||||
'{' Punctuation
|
||||
'host' Name.Label
|
||||
'=' Operator
|
||||
'"' Punctuation
|
||||
'zeus' Literal.String
|
||||
'"' Punctuation
|
||||
'}' Punctuation
|
||||
'[' Punctuation
|
||||
'2h' Literal.String
|
||||
']' Punctuation
|
||||
')' Operator
|
||||
'\n' Text.Whitespace
|
80
spec/tests/promql/test_function_multi_line.txt
Normal file
80
spec/tests/promql/test_function_multi_line.txt
Normal file
@ -0,0 +1,80 @@
|
||||
---input---
|
||||
label_replace(
|
||||
sum by (instance) (
|
||||
irate(node_disk_read_bytes_total[2m])
|
||||
) / 1024 / 1024,
|
||||
"device",
|
||||
'disk',
|
||||
"instance",
|
||||
".*"
|
||||
)
|
||||
|
||||
---tokens---
|
||||
'label_replace' Keyword.Reserved
|
||||
'(' Operator
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'sum' Keyword
|
||||
' ' Text.Whitespace
|
||||
'by' Keyword
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'instance' Name.Variable
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'irate' Keyword.Reserved
|
||||
'(' Operator
|
||||
'node_disk_read_bytes_total' Name.Variable
|
||||
'[' Punctuation
|
||||
'2m' Literal.String
|
||||
']' Punctuation
|
||||
')' Operator
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'/' Operator
|
||||
' ' Text.Whitespace
|
||||
'1024' Literal.Number.Integer
|
||||
' ' Text.Whitespace
|
||||
'/' Operator
|
||||
' ' Text.Whitespace
|
||||
'1024' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'"' Punctuation
|
||||
'device' Literal.String
|
||||
'"' Punctuation
|
||||
',' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
"'" Punctuation
|
||||
'disk' Literal.String
|
||||
"'" Punctuation
|
||||
',' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'"' Punctuation
|
||||
'instance' Literal.String
|
||||
'"' Punctuation
|
||||
',' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'"' Punctuation
|
||||
'.*' Literal.String
|
||||
'"' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
')' Operator
|
||||
'\n' Text.Whitespace
|
87
spec/tests/promql/test_function_multi_line_with_offset.txt
Normal file
87
spec/tests/promql/test_function_multi_line_with_offset.txt
Normal file
@ -0,0 +1,87 @@
|
||||
---input---
|
||||
label_replace(
|
||||
avg by(instance)
|
||||
(irate(node_cpu_seconds_total{mode = "idle"}[5m] offset 3s)
|
||||
) * 100,
|
||||
"device",
|
||||
"cpu",
|
||||
"instance",
|
||||
".*"
|
||||
)
|
||||
|
||||
---tokens---
|
||||
'label_replace' Keyword.Reserved
|
||||
'(' Operator
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'avg' Keyword
|
||||
' ' Text.Whitespace
|
||||
'by' Keyword
|
||||
'(' Operator
|
||||
'instance' Name.Variable
|
||||
')' Operator
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'irate' Keyword.Reserved
|
||||
'(' Operator
|
||||
'node_cpu_seconds_total' Name.Variable
|
||||
'{' Punctuation
|
||||
'mode' Name.Label
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'"' Punctuation
|
||||
'idle' Literal.String
|
||||
'"' Punctuation
|
||||
'}' Punctuation
|
||||
'[' Punctuation
|
||||
'5m' Literal.String
|
||||
']' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'offset' Keyword
|
||||
' ' Text.Whitespace
|
||||
'3s' Literal.String
|
||||
')' Operator
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'*' Operator
|
||||
' ' Text.Whitespace
|
||||
'100' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'"' Punctuation
|
||||
'device' Literal.String
|
||||
'"' Punctuation
|
||||
',' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'"' Punctuation
|
||||
'cpu' Literal.String
|
||||
'"' Punctuation
|
||||
',' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'"' Punctuation
|
||||
'instance' Literal.String
|
||||
'"' Punctuation
|
||||
',' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'"' Punctuation
|
||||
'.*' Literal.String
|
||||
'"' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
')' Operator
|
||||
'\n' Text.Whitespace
|
19
spec/tests/promql/test_function_sum_with_args.txt
Normal file
19
spec/tests/promql/test_function_sum_with_args.txt
Normal file
@ -0,0 +1,19 @@
|
||||
---input---
|
||||
sum by (app, proc) (instance_memory_usage_bytes)
|
||||
|
||||
---tokens---
|
||||
'sum' Keyword
|
||||
' ' Text.Whitespace
|
||||
'by' Keyword
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'app' Name.Variable
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'proc' Name.Variable
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'instance_memory_usage_bytes' Name.Variable
|
||||
')' Operator
|
||||
'\n' Text.Whitespace
|
16
spec/tests/promql/test_matching_operator_no_regex_match.txt
Normal file
16
spec/tests/promql/test_matching_operator_no_regex_match.txt
Normal file
@ -0,0 +1,16 @@
|
||||
---input---
|
||||
metric_test_app{status!~'(4|5)..'}[2m]
|
||||
|
||||
---tokens---
|
||||
'metric_test_app' Name.Variable
|
||||
'{' Punctuation
|
||||
'status' Name.Label
|
||||
'!~' Operator
|
||||
"'" Punctuation
|
||||
'(4|5)..' Literal.String
|
||||
"'" Punctuation
|
||||
'}' Punctuation
|
||||
'[' Punctuation
|
||||
'2m' Literal.String
|
||||
']' Punctuation
|
||||
'\n' Text.Whitespace
|
6
spec/tests/promql/test_metric.txt
Normal file
6
spec/tests/promql/test_metric.txt
Normal file
@ -0,0 +1,6 @@
|
||||
---input---
|
||||
go_gc_duration_seconds
|
||||
|
||||
---tokens---
|
||||
'go_gc_duration_seconds' Name.Variable
|
||||
'\n' Text.Whitespace
|
19
spec/tests/promql/test_metric_multiple_labels.txt
Normal file
19
spec/tests/promql/test_metric_multiple_labels.txt
Normal file
@ -0,0 +1,19 @@
|
||||
---input---
|
||||
go_gc_duration_seconds{instance="localhost:9090",job="alertmanager"}
|
||||
|
||||
---tokens---
|
||||
'go_gc_duration_seconds' Name.Variable
|
||||
'{' Punctuation
|
||||
'instance' Name.Label
|
||||
'=' Operator
|
||||
'"' Punctuation
|
||||
'localhost:9090' Literal.String
|
||||
'"' Punctuation
|
||||
',' Punctuation
|
||||
'job' Name.Label
|
||||
'=' Operator
|
||||
'"' Punctuation
|
||||
'alertmanager' Literal.String
|
||||
'"' Punctuation
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
@ -0,0 +1,22 @@
|
||||
---input---
|
||||
go_gc_duration_seconds{ instance="localhost:9090", job="alertmanager" }
|
||||
|
||||
---tokens---
|
||||
'go_gc_duration_seconds' Name.Variable
|
||||
'{' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'instance' Name.Label
|
||||
'=' Operator
|
||||
'"' Punctuation
|
||||
'localhost:9090' Literal.String
|
||||
'"' Punctuation
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'job' Name.Label
|
||||
'=' Operator
|
||||
'"' Punctuation
|
||||
'alertmanager' Literal.String
|
||||
'"' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
13
spec/tests/promql/test_metric_one_label.txt
Normal file
13
spec/tests/promql/test_metric_one_label.txt
Normal file
@ -0,0 +1,13 @@
|
||||
---input---
|
||||
go_gc_duration_seconds{instance="localhost:9090"}
|
||||
|
||||
---tokens---
|
||||
'go_gc_duration_seconds' Name.Variable
|
||||
'{' Punctuation
|
||||
'instance' Name.Label
|
||||
'=' Operator
|
||||
'"' Punctuation
|
||||
'localhost:9090' Literal.String
|
||||
'"' Punctuation
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
Reference in New Issue
Block a user