Skip to content

Commit 43ca4ed

Browse files
author
Travis B. Hartwell
committed
Create needed TS bucket as part of test setup.
Moved test set into a function to defer running tests until after setup is run. Previously, the tests were executed at the definition site, so they were run before the setup step. This now makes the put that was in the setup fail, but removing that doesn't cause any of the other tests to fail. Also added more context to the is_testable_path so more helpful logging can be shown.
1 parent cc27965 commit 43ca4ed

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

test/integration/re_wm_explore_test.erl

+21-9
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,25 @@
1111
%%%%%%%%%%%%%%%%%%%%%%%%%%
1212
re_wm_explore_test_() ->
1313
{setup,
14+
%% Setup
1415
fun () ->
15-
{ok, "204", _} = ret:http(put, "http://localhost:8098/types/mytype/buckets/test/keys/test", <<"testing">>)
16+
{RiakType, _} = riak_type(),
17+
if RiakType == ts ->
18+
?debugFmt("On TS, so creating bucket", []),
19+
{ok, _, _} = ret:http(put,
20+
"http://localhost:9000/explore/clusters/default/bucket_types/GeoCheckin",
21+
<<"{\"props\":{\"table_def\": \"CREATE TABLE GeoCheckin (myfamily varchar not null, myseries varchar not null, time timestamp not null, myint sint64 not null, mytext varchar not null, myfloat double not null, mybool boolean not null, PRIMARY KEY ((myfamily, myseries, quantum(time, 15, 'm')), myfamily, myseries, time))\"}}">>);
22+
true -> ?debugFmt("On KV, skipping bucket creation", [])
23+
end
1624
end,
25+
%% No cleanup
1726
fun (_) -> ok end,
18-
{timeout, 60, [
19-
all_routes()
20-
]}
21-
}.
27+
%% Tests
28+
fun (_) ->
29+
{timeout, 60, [
30+
all_routes()
31+
]}
32+
end}.
2233

2334
%%%%%%%%%%%%%%%%%%%%
2435
%%% ACTUAL TESTS %%%
@@ -33,7 +44,7 @@ all_routes() ->
3344

3445
assert_paths(_, _, [], _, Accum) -> lists:reverse(Accum);
3546
assert_paths(Method, Base, [Path|Paths], RiakType, Accum) ->
36-
case is_testable_path(Path, RiakType) of
47+
case is_testable_path(Base, Path, RiakType) of
3748
true ->
3849
Url = ret:url(to_path_str(Base) ++ "/" ++ to_path_str(Path)),
3950
Body = path_body(Method, Path),
@@ -126,15 +137,16 @@ riak_type() ->
126137
end.
127138

128139
%% The '*repl*' paths are not testable when Riak OSS is being used
129-
is_testable_path([Path|_], RiakType) ->
140+
%% The '*tables*' paths are not testable when Riak KV is being used
141+
is_testable_path(Base, [Path|_], RiakType) ->
130142
case {lists:prefix("repl", Path),
131143
lists:prefix("tables", Path),
132144
RiakType} of
133145
{true, _, {_, oss}} ->
134-
?debugFmt("Skipping ~p because we are on Riak OSS.~n", [Path]),
146+
?debugFmt("Skipping ~p/~p because we are on Riak OSS.~n", [Base, Path]),
135147
false;
136148
{_, true, {kv, _}} ->
137-
?debugFmt("Skipping ~p because we are on Riak KV.~n", [Path]),
149+
?debugFmt("Skipping ~p/~p because we are on Riak KV.~n", [Base, Path]),
138150
false;
139151
_ -> true
140152
end.

0 commit comments

Comments
 (0)