Update tests to use connection_info for HTTP host/port pairs.

This commit is contained in:
Sean Cribbs 2013-09-11 12:31:49 -05:00
parent a115567ab9
commit d84a7cc38e
5 changed files with 18 additions and 21 deletions

View File

@ -207,13 +207,13 @@ rpc_get_env(Node, [{App,Var}|Others]) ->
-type interfaces() :: [interface()].
-type conn_info() :: [{node(), interfaces()}].
-spec connection_info([node()]) -> conn_info().
connection_info(Nodes) ->
[begin
{ok, [{PB_IP, PB_Port}]} = get_pb_conn_info(Node),
{ok, [{HTTP_IP, HTTP_Port}]} = get_http_conn_info(Node),
{Node, [{http, {HTTP_IP, HTTP_Port}}, {pb, {PB_IP, PB_Port}}]}
end || Node <- Nodes].
-spec connection_info(node() | [node()]) -> interfaces() | conn_info().
connection_info(Node) when is_atom(Node) ->
{ok, [{PB_IP, PB_Port}]} = get_pb_conn_info(Node),
{ok, [{HTTP_IP, HTTP_Port}]} = get_http_conn_info(Node),
[{http, {HTTP_IP, HTTP_Port}}, {pb, {PB_IP, PB_Port}}];
connection_info(Nodes) when is_list(Nodes) ->
[ {Node, connection_info(Node)} || Node <- Nodes].
-spec get_pb_conn_info(node()) -> [{inet:ip_address(), pos_integer()}].
get_pb_conn_info(Node) ->
@ -1164,5 +1164,3 @@ post_result(TestResult, #rt_webhook{url=URL, headers=HookHeaders, name=Name}) ->
lager:error("Error reporting to ~s. ~p", [Name, Throws]),
lager:error("Payload: ~s", [mochijson2:encode(TestResult)])
end.

View File

@ -36,7 +36,7 @@ confirm() ->
[Node1] = Nodes,
?assertEqual(ok, rt:wait_until_nodes_ready([Node1])),
{ok, [{IP, _Port}|_]} = rpc:call(Node1, application, get_env, [riak_core, http]),
[{http, {IP, _Port}}|_] = rt:connection_info(Node1),
JMXDumpCmd = jmx_dump_cmd(IP, JMXPort),

View File

@ -3,9 +3,10 @@
-export([confirm/0]).
-include_lib("eunit/include/eunit.hrl").
-define(RC_ENABLE_CFG,
[{riak_core,
[
{riak_api, [{https, [{"127.0.0.1", 8069}]}]},
{riak_core,
[
{https, [{"127.0.0.1", 8069}]},
{ssl,
[{certfile, "./etc/cert.pem"},
{keyfile, "./etc/key.pem"}

View File

@ -74,10 +74,9 @@ confirm() ->
ok = rt:wait_for_cluster_service(Nodes, riak_kv),
%% verify all nodes agree
[?assertEqual(ok, rt:wait_until(Node, fun(N) ->
{ok, [HP]} = rpc:call(N, application, get_env, [riak_core, http]),
11 == get_counter(HP, Key)
end)) || Node <- Nodes],
[?assertEqual(ok, rt:wait_until(fun() ->
11 == get_counter(HP, Key)
end)) || HP <- Hosts ],
pass.
@ -91,8 +90,8 @@ set_allow_mult_true(Nodes) ->
rt:wait_until_ring_converged(Nodes).
get_host_ports(Nodes) ->
{ResL, []} = rpc:multicall(Nodes, application, get_env, [riak_core, http]),
[{Host, Port} || {ok, [{Host, Port}]} <- ResL].
ResL = rt:connection_info(Nodes),
[{Host, Port} || {_Node, [{http, [{Host, Port}|_]}|_]} <- ResL].
%% Counter API
get_counter(HostPort, Key) ->

View File

@ -103,9 +103,8 @@ verify_query(Cfg, Bucket, Key, Query, Expected) ->
get_config(Node0) ->
{ok, [{IP, Port}|_]} =
rpc:call(Node0, application, get_env, [riak_core, http]),
Prefix =
[{http, {IP, Port}}|_] = rt:connection_info(Node0),
Prefix =
rpc:call(Node0, app_helper, get_env, [riak_kv, raw_name, "riak"]),
#config{ip = IP, port = Port, prefix = Prefix}.