mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-06 22:27:17 +02:00
fix promql-test error message and readme
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
This commit is contained in:
parent
b6aaea22fb
commit
a177376d72
@ -111,7 +111,7 @@ eval range from <start> to <end> step <step> <query>
|
|||||||
### `expect` Syntax
|
### `expect` Syntax
|
||||||
|
|
||||||
```
|
```
|
||||||
expect <type> <match_type> <string>
|
expect <type> <match_type>: <string>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
@ -139,8 +139,8 @@ eval instant at 1m sum by (env) (my_metric)
|
|||||||
{env="test"} 20
|
{env="test"} 20
|
||||||
|
|
||||||
eval range from 0 to 3m step 1m sum by (env) (my_metric)
|
eval range from 0 to 3m step 1m sum by (env) (my_metric)
|
||||||
expect warn msg something went wrong
|
expect warn msg: something went wrong
|
||||||
expect info regex something went (wrong|boom)
|
expect info regex: something went (wrong|boom)
|
||||||
{env="prod"} 2 5 10 20
|
{env="prod"} 2 5 10 20
|
||||||
{env="test"} 10 20 30 45
|
{env="test"} 10 20 30 45
|
||||||
|
|
||||||
@ -148,10 +148,10 @@ eval instant at 1m ceil({__name__=~'testmetric1|testmetric2'})
|
|||||||
expect fail
|
expect fail
|
||||||
|
|
||||||
eval instant at 1m ceil({__name__=~'testmetric1|testmetric2'})
|
eval instant at 1m ceil({__name__=~'testmetric1|testmetric2'})
|
||||||
expect fail msg "vector cannot contain metrics with the same labelset"
|
expect fail msg: "vector cannot contain metrics with the same labelset"
|
||||||
|
|
||||||
eval instant at 1m ceil({__name__=~'testmetric1|testmetric2'})
|
eval instant at 1m ceil({__name__=~'testmetric1|testmetric2'})
|
||||||
expect fail regex "vector cannot contain metrics .*|something else went wrong"
|
expect fail regex: "vector cannot contain metrics .*|something else went wrong"
|
||||||
|
|
||||||
eval instant at 1m sum by (env) (my_metric)
|
eval instant at 1m sum by (env) (my_metric)
|
||||||
expect ordered
|
expect ordered
|
||||||
|
@ -271,7 +271,7 @@ func parseExpect(defLine string) (expectCmdType, expectCmd, error) {
|
|||||||
expectParts := patExpect.FindStringSubmatch(strings.TrimSpace(defLine))
|
expectParts := patExpect.FindStringSubmatch(strings.TrimSpace(defLine))
|
||||||
expCmd := expectCmd{}
|
expCmd := expectCmd{}
|
||||||
if expectParts == nil {
|
if expectParts == nil {
|
||||||
return 0, expCmd, errors.New("invalid expect statement, must match `expect <type> <match_type> <string>` format")
|
return 0, expCmd, errors.New("invalid expect statement, must match `expect <type> <match_type>: <string>` format")
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
mode = expectParts[1]
|
mode = expectParts[1]
|
||||||
|
@ -699,7 +699,7 @@ load 5m
|
|||||||
eval_fail instant at 0m ceil({__name__=~'testmetric1|testmetric2'})
|
eval_fail instant at 0m ceil({__name__=~'testmetric1|testmetric2'})
|
||||||
expect fail error: something went wrong
|
expect fail error: something went wrong
|
||||||
`,
|
`,
|
||||||
expectedError: "error in eval ceil({__name__=~'testmetric1|testmetric2'}) (line 7): invalid expect statement, must match `expect <type> <match_type> <string>` format",
|
expectedError: "error in eval ceil({__name__=~'testmetric1|testmetric2'}) (line 7): invalid expect statement, must match `expect <type> <match_type>: <string>` format",
|
||||||
},
|
},
|
||||||
"instant query expected not to care about annotations (with new eval syntax)": {
|
"instant query expected not to care about annotations (with new eval syntax)": {
|
||||||
input: `
|
input: `
|
||||||
|
Loading…
Reference in New Issue
Block a user