RTS-890: Change expected error message for

ts_simple_select_unexpected_token_not_allowed
This commit is contained in:
Brett Hazen 2016-02-03 04:41:08 +00:00
parent 304652b69f
commit d6a30c9f2f
2 changed files with 11 additions and 2 deletions

View File

@ -33,7 +33,7 @@ confirm() ->
Qry =
"selectah * from GeoCheckin "
"Where time > 1 and time < 10",
{error, Got} = ts_util:ts_query(
Got = ts_util:ts_query(
ts_util:cluster_and_connect(single), TestType, DDL, Data, Qry),
?assertNotEqual(0, string:str(binary_to_list(Got), "Unexpected token")),
ts_util:assert_error_regex({error, {1020, <<".*Unexpected token.*">>}}, Got),
pass.

View File

@ -25,6 +25,7 @@
activate_bucket_type/2,
activate_bucket_type/3,
assert/3,
assert_error_regex/2,
assert_float/3,
build_cluster/1,
cluster_and_connect/1,
@ -496,6 +497,14 @@ assert(String, Exp, Got) -> lager:info("*****************", []),
lager:info("*****************", []),
fail.
%% Match an error code and use a regex to match the error string
assert_error_regex({error, {Code, Regex}}, {error, {Code, Msg}}) ->
{ok, RE} = re:compile(Regex),
Match = re:run(Msg, RE),
?assertNotEqual(Match, nomatch);
assert_error_regex(Got, Expected) ->
?assertEqual(Got, Expected).
results(Results) ->
Expected = lists:duplicate(length(Results), pass),
?assertEqual(Expected, Results).