Created a riak_test scratch dir for downloading clients

This commit is contained in:
Joe DeVivo 2012-10-25 09:48:38 -07:00
parent 6a0729c64a
commit 591d3f4752
4 changed files with 23 additions and 15 deletions

View File

@ -9,6 +9,7 @@
lager
]},
{env, [
{rt_scratch_dir, "/tmp/riak_test_scratch"},
{rt_max_wait_time, 180000},
{rt_retry_delay, 500},
{rt_harness, rtdev},

View File

@ -74,6 +74,13 @@ main(Args) ->
%% Loads from ~/.riak_test.config
rt:load_config(Config),
%% Ensure existance of scratch_dir
case file:make_dir(rt:config(rt_scratch_dir)) of
ok -> great;
{eexist, _} -> great;
{ErrorType, ErrorReason} -> lager:error("Could not create scratch dir, {~p, ~p}", [ErrorType, ErrorReason])
end,
%% Fileoutput
Outdir = proplists:get_value(outdir, ParsedArgs),
ConsoleLagerLevel = case Outdir of

View File

@ -38,11 +38,10 @@ java_unit_tests(HTTP_Host, HTTP_Port, _PB_Host, PB_Port) ->
%% run the following:
Cmd = io_lib:format("java -Dcom.basho.riak.host=~s -Dcom.basho.riak.http.port=~p -Dcom.basho.riak.pbc.port=~p -cp ~s:~s org.junit.runner.JUnitCore com.basho.riak.client.AllTests",
[HTTP_Host, HTTP_Port, PB_Port, ?JAVA_FAT_FILENAME, ?JAVA_TESTS_FILENAME]),
[HTTP_Host, HTTP_Port, PB_Port, rt:config(rt_scratch_dir) ++ "/" ++ ?JAVA_FAT_FILENAME, rt:config(rt_scratch_dir) ++ "/" ++ ?JAVA_TESTS_FILENAME]),
lager:info("Cmd: ~s", [Cmd]),
{ExitCode, JavaLog} = rt:stream_cmd(Cmd),
%%JavaLog = os:cmd(Cmd),
{ExitCode, JavaLog} = rt:stream_cmd(Cmd, [{cd, rt:config(rt_scratch_dir)}]),
?assertEqual(0, ExitCode),
lager:info(JavaLog),
?assertNot(rt:str(JavaLog, "FAILURES!!!")),
@ -56,7 +55,8 @@ you_got_jars(Url, Filename) ->
ok;
{error, _} ->
lager:info("Getting it ~p", [Filename]),
Log = os:cmd("curl -O -L " ++ Url),
lager:info("curl log: ~p", [Log]);
rt:stream_cmd("curl -O -L " ++ Url, [{cd, rt:config(rt_scratch_dir)}]);
%%Log = os:cmd("cd " ++ rt:config(rt_scratch_dir) ++ " ; curl -O -L " ++ Url),
%%lager:info("curl log: ~p", [Log]);
_ -> meh
end.

View File

@ -8,7 +8,7 @@ confirm() ->
prereqs(),
GemDir = dat_gem(),
rt:update_app_config(all, [{riak_kv, [{test, true},
{add_paths, chomp(os:cmd("cd " ++ GemDir ++ " ; pwd")) ++ "/erl_src"}]},
{add_paths, GemDir ++ "/erl_src"}]},
{riak_search, [{enabled, true},
{backend, riak_search_test_backend}]}]
),
@ -63,15 +63,15 @@ prereqs() ->
% Download the ruby-client gem, unpack it and build it locally
dat_gem() ->
lager:info("Fetching riak-client gem"),
%GemInstalled = os:cmd("gem fetch riak-client"),
%GemFile = string:substr(GemInstalled, 12, length(GemInstalled) - 12),
GemFile = "riak-client",
GemInstalled = os:cmd("cd " ++ rt:config(rt_scratch_dir) ++ " ; gem fetch riak-client"),
GemFile = string:substr(GemInstalled, 12, length(GemInstalled) - 12),
%GemFile = "riak-client",
lager:info("Downloaded gem: ~s", [GemFile]),
rt:stream_cmd(io_lib:format("gem unpack ~s.gem", [GemFile]), [{cd, rt:config(rt_scratch_dir)}]),
Cmd = "bundle install --without=guard --no-deployment --binstubs --no-color",
lager:info(Cmd),
{_Exit, _Log} = rt:stream_cmd(Cmd, [{cd, GemFile}, {env, [{"BUNDLE_PATH", "vendor/bundle"}]}]),
GemFile.
chomp(String) ->
string:strip(String, right, $\n).
GemDir = rt:config(rt_scratch_dir) ++ "/" ++ GemFile,
{_Exit, _Log} = rt:stream_cmd(Cmd, [{cd, GemDir}, {env, [{"BUNDLE_PATH", "vendor/bundle"}]}]),
GemDir.