From 03094eff04a3d860fb0d8c8cfed88ae7fd011ec4 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Tue, 12 May 2015 12:00:28 +0200 Subject: [PATCH] Migrate parsing error tests. The promql_test checks failure of various bad syntaxed queries. Those are moved into the parser tests as the new testing language only deals with valid queries. --- promql/parse_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/promql/parse_test.go b/promql/parse_test.go index 9940f0468..dfeac7eec 100644 --- a/promql/parse_test.go +++ b/promql/parse_test.go @@ -167,6 +167,10 @@ var testExpr = []struct { input: "((1)", fail: true, errMsg: "unclosed left parenthesis", + }, { + input: "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", + fail: true, + errMsg: "out of range", }, { input: "(", fail: true, @@ -476,6 +480,14 @@ var testExpr = []struct { input: "foo or on(bar) group_right(baz) bar", fail: true, errMsg: "no grouping allowed for AND and OR operations", + }, { + input: `http_requests{group="production"} / on(instance) group_left cpu_count{type="smp"}`, + fail: true, + errMsg: "unexpected identifier \"cpu_count\" in grouping opts, expected \"(\"", + }, { + input: `http_requests{group="production"} + on(instance) group_left(job,instance) cpu_count{type="smp"}`, + fail: true, + errMsg: "label \"instance\" must not occur in ON and INCLUDE clause at once", }, // Test vector selector. { @@ -662,6 +674,9 @@ var testExpr = []struct { input: `foo[5m] OFFSET 1h30m`, fail: true, errMsg: "bad number or duration syntax: \"1h3\"", + }, { + input: `foo["5m"]`, + fail: true, }, { input: `foo[]`, fail: true,