Reorganize tests into a real spec suite

This commit is contained in:
2024-08-04 19:18:43 -03:00
parent 57c160173c
commit e7c2053222
693 changed files with 136 additions and 116 deletions

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@ -0,0 +1,6 @@
---input---
go_gc_duration_seconds
---tokens---
'go_gc_duration_seconds' Name.Variable
'\n' Text.Whitespace

View 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

View File

@ -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

View 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