Skip to content

Commit f172a3a

Browse files
committed
Fix tests
1 parent 1878f68 commit f172a3a

File tree

2 files changed

+28
-17
lines changed

2 files changed

+28
-17
lines changed

src/Parsers/Prometheus/tests/gtest_PromQLParser.cpp

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,70 +1180,88 @@ PrometheusQueryTree(INSTANT_VECTOR):
11801180
}
11811181

11821182

1183-
TEST(PrometheusQueryTree, ParseStringLiterals)
1183+
TEST(PromQLParser, ParseStringLiterals)
11841184
{
1185-
EXPECT_EQ(parseAndDumpTree(R"(
1185+
EXPECT_EQ(parse(R"(
11861186
"this is a string"
11871187
)"), R"(
1188+
"this is a string"
1189+
11881190
PrometheusQueryTree(STRING):
11891191
StringLiteral('this is a string')
11901192
)");
11911193

1192-
EXPECT_EQ(parseAndDumpTree(R"(
1194+
EXPECT_EQ(parse(R"(
11931195
"\n"
11941196
)"), R"(
1197+
"\n"
1198+
11951199
PrometheusQueryTree(STRING):
11961200
StringLiteral('\n')
11971201
)");
11981202

11991203
#if 0 /// FIXME
1200-
EXPECT_EQ(parseAndDumpTree(R"(
1204+
EXPECT_EQ(parse(R"(
12011205
"these are unescaped: \n \\ ' \" ` \t"
12021206
)"), R"(
1207+
"these are unescaped: \n \\ ' \" ` \t"
1208+
12031209
PrometheusQueryTree(STRING):
12041210
StringLiteral('these are unescaped: \n \\ \' " ` \t')
12051211
)");
12061212

1207-
EXPECT_EQ(parseAndDumpTree(R"(
1213+
EXPECT_EQ(parse(R"(
12081214
'these are unescaped: \n \\ \' " ` \t'
12091215
)"), R"(
1216+
"these are unescaped: \n \\ ' \" ` \t"
1217+
12101218
PrometheusQueryTree(STRING):
12111219
StringLiteral('these are unescaped: \n \\ \' " ` \t')
12121220
)");
12131221

1214-
EXPECT_EQ(parseAndDumpTree(R"(
1222+
EXPECT_EQ(parse(R"(
12151223
`these are not unescaped: \n \\ ' " \t`
12161224
)"), R"(
1225+
"these are not unescaped: \\n \\\\ ' \" \\t"
1226+
12171227
PrometheusQueryTree(STRING):
12181228
StringLiteral('these are not unescaped: \n \\ \' " \\t')
12191229
)");
12201230

1221-
EXPECT_EQ(parseAndDumpTree(R"(
1231+
EXPECT_EQ(parse(R"(
12221232
"日本語"
12231233
)"), R"(
1234+
"日本語"
1235+
12241236
PrometheusQueryTree(STRING):
12251237
StringLiteral('日本語')
12261238
)");
12271239
#endif
12281240

1229-
EXPECT_EQ(parseAndDumpTree(R"(
1241+
EXPECT_EQ(parse(R"(
12301242
"\u65e5\u672c\u8a9e"
12311243
)"), R"(
1244+
"日本語"
1245+
12321246
PrometheusQueryTree(STRING):
12331247
StringLiteral('日本語')
12341248
)");
12351249

1236-
EXPECT_EQ(parseAndDumpTree(R"(
1250+
EXPECT_EQ(parse(R"(
12371251
"\U000065e5\U0000672c\U00008a9e"
12381252
)"), R"(
1253+
"日本語"
1254+
12391255
PrometheusQueryTree(STRING):
12401256
StringLiteral('日本語')
12411257
)");
12421258

12431259
#if 0 /// FIXME
1244-
EXPECT_EQ(parseAndDumpTree(R"(
1260+
EXPECT_EQ(parse(R"(
12451261
"\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e"
12461262
)"), R"(
1263+
"日本語"
1264+
12471265
PrometheusQueryTree(STRING):
12481266
StringLiteral('日本語')
12491267
)");

tests/integration/test_prometheus_protocols/test_evaluation.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -447,13 +447,6 @@ def test_function_over_time():
447447
"[('1970-01-01 00:02:00.000',0),('1970-01-01 00:02:15.000',0.06666666666666667),('1970-01-01 00:02:30.000',0.1),('1970-01-01 00:02:45.000',0.05555555555555555),('1970-01-01 00:03:30.000',0.08333333333333333)]",
448448
]
449449
],
450-
# FIXME: Results are different!
451-
# | E assert '{"resultType..., "0.08"]]}]}' == '{"resultType...3333333"]]}]}'
452-
# | E
453-
# | E - {"resultType": "matrix", "result": [{"metric": {}, "values": [[120, "0"], [135, "0.06666666666666667"], [150, "0.1"], [165, "0.05555555555555555"], [210, "0.08333333333333333"]]}]}
454-
# | E ? --------------- ^^^^^^^^^^^^^^^^ ---------------
455-
# | E + {"resultType": "matrix", "result": [{"metric": {}, "values": [[120, "0"], [135, "0.07"], [150, "0.1"], [165, "0.06"], [210, "0.08"]]}]}
456-
False,
457450
)
458451

459452
do_query_test(

0 commit comments

Comments
 (0)