Repository: prometheus/prometheus
File: promql/promqltest/test_test.go (Go)

Code before:
				eval instant at 50m ("")
					expect string
			`,
		},
		"instant query with string literal - not quoted": {
			input: `
				eval instant at 50m ("Foo")
					expect string Foo
			`,
			expectedError: `error in eval ("Foo") (line 3): expected string literal must be within quotes`,
		},
		"instant query with empty string literal": {
			input: `
				eval instant at 50m ("Foo")
					expect string
			`,
			expectedError: `error in eval ("Foo") (line 2): expected string "" but got "Foo"`,
		},
		"instant query with error string literal": {
			input: `
				eval instant at 50m ("Foo")
					expect string "Bar"
			`,
			expectedError: `error in eval ("Foo") (line 2): expected string "Bar" but got "Foo"`,
		},
		"instant query with range result - result has a series that is not expected": {
			input: `
				load 10s
  					some_metric{env="a"} 1+1x5

				eval instant at 1m some_metric[1m]
					expect range vector from 10s to 1m step 10s
  					some_metric{env="a"} 2 3 4 5 6
  					some_metric{env="b"} 4 6 8 10 12
			`,
			expectedError: `error in eval some_metric[1m] (line 5): expected metric {__name__="some_metric", env="b"} not found`,
		},
		"instant query with range result - result has a value that is not expected": {
			input: `
				load 10s
  					some_metric{env="a"} 1+1x5

				eval instant at 1m some_metric[1m]
					expect range vector from 10s to 1m step 10s
  					some_metric{env="a"} 9 3 4 5 6
			`,
			expectedError: `error in eval some_metric[1m] (line 5): expected float value at index 0 (t=10000) for {__name__="some_metric", env="a"} to be 9, but got 2 (result has 5 float points [2 @[10000] 3 @[20000] 4 @[30000] 5 @[40000] 6 @[50000]] and 0 histogram points [])`,
		},
		"instant query with range result - invalid expect range vector directive": {
			input: `
				load 10s

Review comment (suggestion):
```suggestion
		"instant query with range result - result does not have a series that is expected": {
```

Code after:
				eval instant at 50m ("")
					expect string
			`,
			expectedError: `error in eval ("") (line 3): expected string literal not valid - a quoted string literal is required`,
		},
		"instant query with string literal with correctly quoted empty string": {
			input: `
				eval instant at 50m ("")
					expect string ""
			`,
		},
		"instant query with string literal - not quoted": {
			input: `
				eval instant at 50m ("Foo")
					expect string Foo
			`,
			expectedError: `error in eval ("Foo") (line 3): expected string literal not valid - check that the string is correctly quoted`,
		},
		"instant query with empty string literal": {
			input: `
				eval instant at 50m ("Foo")
					expect string ""
			`,
			expectedError: `error in eval ("Foo") (line 2): expected string "" but got "Foo"`,
		},
		"instant query with error string literal": {
			input: `
				eval instant at 50m ("Foo")
					expect string "Bar"
			`,
			expectedError: `error in eval ("Foo") (line 2): expected string "Bar" but got "Foo"`,
		},
		"instant query with range result - result does not have a series that is expected": {
			input: `
				load 10s
  					some_metric{env="a"} 1+1x5

				eval instant at 1m some_metric[1m]
					expect range vector from 10s to 1m step 10s
  					some_metric{env="a"} 2 3 4 5 6
  					some_metric{env="b"} 4 6 8 10 12
			`,
			expectedError: `error in eval some_metric[1m] (line 5): expected metric {__name__="some_metric", env="b"} not found`,
		},
		"instant query with range result - result has a series which is not expected": {
			input: `
				load 10s
  					some_metric{env="a"} 1+1x5
					some_metric{env="b"} 1+1x5

				eval instant at 1m some_metric[1m]