Skip to content

Commit

Permalink
Merge pull request #176 from basho/fix-ms-riak-test-inner-starting-inets
Browse files Browse the repository at this point in the history
Fixed riak_test so doesn't fail on starting inets.
  • Loading branch information
lordnull committed Mar 11, 2015
2 parents 80c58ec + fec8b87 commit 8fe4a8c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/riak_search_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ test_inner({solr_select, Host, Port, Params, Validators}, _Root) ->
test_inner({solr_select, Host, Port, Params, 200, Validators}, _Root);

test_inner({solr_select, Host, Port, Params, Expected, Validators}, _Root) ->
ok = inets:start(),
ok = start_inets(),
Query = proplists:get_value(q, Params),
QS = to_querystring(Params),
Url = io_lib:format("http://~s:~p/solr/~s/select?~s", [Host, Port, ?TEST_INDEX, QS]),
Expand Down Expand Up @@ -203,7 +203,7 @@ test_inner({solr_update, Path, Params}, Root) ->
io:format("~n :: Running Solr Update '~s' (via HTTP)...~n", [Path]),

%% Run the update command...
ok = inets:start(),
ok = start_inets(),
case file:read_file(filename:join(Root, Path)) of
{ok, Bytes} ->
{Hostname, Port} = hd(app_helper:get_env(riak_api, http)),
Expand Down Expand Up @@ -405,3 +405,11 @@ to_querystring(Params) ->
QSParts = [F(K, V) || {K, V} <- Params],
string:join(QSParts, "&").

start_inets() ->
start_inets(inets:start()).

start_inets(ok) ->
ok;

start_inets({error, {already_started, inets}}) ->
ok.

0 comments on commit 8fe4a8c

Please sign in to comment.