mirror of
https://github.com/valitydev/riak_test.git
synced 2024-11-07 00:55:21 +00:00
Merge remote-tracking branch 'origin/riak/2.0' into bch-merge-2.0-onto-develop-2.2
This commit is contained in:
commit
8abe51a59f
46
src/rt.erl
46
src/rt.erl
@ -143,6 +143,7 @@
|
||||
upgrade/2,
|
||||
upgrade/3,
|
||||
versions/0,
|
||||
wait_for_any_webmachine_route/2,
|
||||
wait_for_cluster_service/2,
|
||||
wait_for_cmd/1,
|
||||
wait_for_service/2,
|
||||
@ -1932,30 +1933,31 @@ wait_for_control(_Vsn, Node) when is_atom(Node) ->
|
||||
end
|
||||
end),
|
||||
|
||||
lager:info("Waiting for routes to be added to supervisor..."),
|
||||
|
||||
%% Wait for routes to be added by supervisor.
|
||||
rt:wait_until(Node, fun(N) ->
|
||||
case rpc:call(N,
|
||||
webmachine_router,
|
||||
get_routes,
|
||||
[]) of
|
||||
{badrpc, Error} ->
|
||||
lager:info("Error was ~p.", [Error]),
|
||||
false;
|
||||
Routes ->
|
||||
case is_control_gui_route_loaded(Routes) of
|
||||
false ->
|
||||
false;
|
||||
_ ->
|
||||
true
|
||||
end
|
||||
end
|
||||
end).
|
||||
wait_for_any_webmachine_route(Node, [admin_gui, riak_control_wm_gui]).
|
||||
|
||||
%% @doc Is the riak_control GUI route loaded?
|
||||
is_control_gui_route_loaded(Routes) ->
|
||||
lists:keymember(admin_gui, 2, Routes) orelse lists:keymember(riak_control_wm_gui, 2, Routes).
|
||||
wait_for_any_webmachine_route(Node, Routes) ->
|
||||
lager:info("Waiting for routes ~p to be added to webmachine.", [Routes]),
|
||||
rt:wait_until(Node, fun(N) ->
|
||||
case rpc:call(N, webmachine_router, get_routes, []) of
|
||||
{badrpc, Error} ->
|
||||
lager:info("Error was ~p.", [Error]),
|
||||
false;
|
||||
RegisteredRoutes ->
|
||||
case is_any_route_loaded(Routes, RegisteredRoutes) of
|
||||
false ->
|
||||
false;
|
||||
_ ->
|
||||
true
|
||||
end
|
||||
end
|
||||
end).
|
||||
|
||||
is_any_route_loaded(SearchRoutes, RegisteredRoutes) ->
|
||||
lists:any(fun(Route) -> is_route_loaded(Route, RegisteredRoutes) end, SearchRoutes).
|
||||
|
||||
is_route_loaded(Route, Routes) ->
|
||||
lists:keymember(Route, 2, Routes).
|
||||
|
||||
%% @doc Wait for Riak Control to start on a series of nodes.
|
||||
wait_for_control(VersionedNodes) when is_list(VersionedNodes) ->
|
||||
|
Loading…
Reference in New Issue
Block a user