Skip to content
Browse files

Refactor luwak tests to group the tests into test suites to avoid

unecessary setup and teardown of the test environment between
each test case. Also correct the starting and stopping of the
sasl application and fix the includes for luwak.hrl.
  • Loading branch information...
1 parent e7829da commit 031454790a57859b7769c3b291a51d86a1e26d71 @kellymclaughlin kellymclaughlin committed Aug 4, 2011
View
6 include/luwak.hrl
@@ -12,12 +12,16 @@
-record(split, {head=[], midhead=[], middle=[], midtail=[], tail=[]}).
--ifndef(EUNIT_HRL).
+-ifdef(TEST).
-ifdef(DEBUG).
+-undef(debugMsg).
+-undef(debugFmt).
-define(debugMsg(S), error_logger:info_msg(S)).
-define(debugFmt(S, As), error_logger:info_msg(S,As)).
-else.
+-undef(debugMsg).
+-undef(debugFmt).
-define(debugMsg(S), ok).
-define(debugFmt(S, As), ok).
-endif.
View
2 src/luwak_block.erl
@@ -1,6 +1,6 @@
-module(luwak_block).
--include_lib("luwak.hrl").
+-include("luwak.hrl").
-export([create/2,
data/1,
View
2 src/luwak_file.erl
@@ -14,7 +14,7 @@
name/1,
length/2]).
--include_lib("luwak.hrl").
+-include("luwak.hrl").
%% @spec create(Riak :: riak(), Name :: binary(), Attributes :: dict())
%% -> {ok, File :: luwak_file()}
View
3 src/luwak_get_stream.erl
@@ -6,8 +6,7 @@
-record(map, {riak,blocksize,ref,pid,offset,endoffset}).
--include_lib("luwak.hrl").
-
+-include("luwak.hrl").
%% @spec start(Riak :: riak(), File :: luwak_file(),
%% Start :: int(), Length :: length()) ->
View
2 src/luwak_io.erl
@@ -5,7 +5,7 @@
truncate/3,
no_tree_put_range/4]).
--include_lib("luwak.hrl").
+-include("luwak.hrl").
%% @spec put_range(Riak :: riak(), File :: luwak_file(),
%% Start :: int(), Data :: binary()) ->
View
2 src/luwak_put_stream.erl
@@ -4,7 +4,7 @@
-record(state, {file,offset,blocksize,ref,ttl,written=[],buffer=[],
buffersize=0,checksumming=false,ctx=crypto:sha_init()}).
--include_lib("luwak.hrl").
+-include("luwak.hrl").
%% API
-export([start_link/4,
View
2 src/luwak_tree.erl
@@ -9,7 +9,7 @@
truncate/7,
truncate/1]).
--include_lib("luwak.hrl").
+-include("luwak.hrl").
%%=======================================
%% Public API
View
2 src/luwak_tree_utils.erl
@@ -1,6 +1,6 @@
-module(luwak_tree_utils).
--include_lib("luwak.hrl").
+-include("luwak.hrl").
-export([longest_divisable_subtree/2,
longest_divisable_subtree/4,
View
2 src/luwak_wm_file.erl
@@ -121,7 +121,7 @@
-include_lib("webmachine/include/webmachine.hrl").
-include_lib("riak_kv/src/riak_kv_wm_raw.hrl").
--include_lib("luwak.hrl").
+-include("luwak.hrl").
-define(HEAD_RANGE, "Range").
-define(HEAD_CRANGE, "Content-Range").
View
22 test/luwak_checksum_tests.erl
@@ -1,8 +1,24 @@
-module(luwak_checksum_tests).
+-ifdef(TEST).
+
-include_lib("eunit/include/eunit.hrl").
-one_off_checksum_test() ->
+checksum_test_() ->
+ {spawn,
+ [{setup,
+ fun test_helper:setup/0,
+ fun test_helper:cleanup/1,
+ [
+ {timeout, 60000,
+ [fun one_off_checksum/0,
+ fun do_a_simple_checksum/0]}
+ ]
+ }
+ ]
+ }.
+
+one_off_checksum() ->
test_helper:riak_test(fun(Riak) ->
Sha = crypto:sha(<<"chilled monkey brains">>),
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{tree_order,2},{block_size,2}], dict:new()),
@@ -12,10 +28,12 @@ one_off_checksum_test() ->
?assertEqual(Sha, Checksum)
end).
-do_a_simple_checksum_test() ->
+do_a_simple_checksum() ->
test_helper:riak_test(fun(Riak) ->
Sha = crypto:sha(<<"chilled monkey brains">>),
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{checksumming,true}], dict:new()),
{ok, _, File1} = luwak_io:put_range(Riak, File, 0, <<"chilled monkey brains">>),
?assertEqual({sha1,Sha}, luwak_file:get_property(File1,checksum))
end).
+
+-endif.
View
35 test/luwak_file_tests.erl
@@ -1,35 +1,54 @@
-module(luwak_file_tests).
+-ifdef(TEST).
+
-include_lib("eunit/include/eunit.hrl").
-object_creation_test() ->
- test_helper:riak_test(fun(Riak) ->
+file_test_() ->
+ {spawn,
+ [{setup,
+ fun test_helper:setup/0,
+ fun test_helper:cleanup/1,
+ [
+ {timeout, 60000,
+ [fun object_creation/0,
+ fun set_attributes/0,
+ fun exists/0,
+ fun delete/0]}
+ ]
+ }
+ ]
+ }.
+
+object_creation() ->
+ test_helper:riak_test(fun(Riak) ->
Dict = dict:new(),
luwak_file:create(Riak, <<"file1">>, dict:store(key, value, Dict)),
{ok, Obj} = luwak_file:get(Riak, <<"file1">>),
Attr = luwak_file:get_attributes(Obj),
?assertEqual({ok, value}, dict:find(key, Attr))
end).
-
-set_attributes_test() ->
+
+set_attributes() ->
test_helper:riak_test(fun(Riak) ->
Dict = dict:new(),
{ok, Obj} = luwak_file:create(Riak, <<"file1">>, dict:store(key, value, Dict)),
{ok, Obj2} = luwak_file:set_attributes(Riak, Obj, dict:store(key, blah, Dict)),
Attr = luwak_file:get_attributes(Obj2),
?assertEqual({ok, blah}, dict:find(key, Attr))
end).
-
-exists_test() ->
+
+exists() ->
test_helper:riak_test(fun(Riak) ->
{ok, _Obj} = luwak_file:create(Riak, <<"file1">>, dict:new()),
?assertEqual({ok, true}, luwak_file:exists(Riak, <<"file1">>))
end).
-
-delete_test() ->
+
+delete() ->
test_helper:riak_test(fun(Riak) ->
{ok, _Obj} = luwak_file:create(Riak, <<"file1">>, dict:new()),
ok = luwak_file:delete(Riak, <<"file1">>),
?assertEqual({ok, false}, luwak_file:exists(Riak, <<"file1">>))
end).
+-endif.
View
36 test/luwak_get_stream_tests.erl
@@ -1,8 +1,28 @@
-module(luwak_get_stream_tests).
+-ifdef(TEST).
+
-include_lib("eunit/include/eunit.hrl").
-simple_get_stream_test() ->
+get_stream_test_() ->
+ {spawn,
+ [{setup,
+ fun test_helper:setup/0,
+ fun test_helper:cleanup/1,
+ [
+ {timeout, 60000,
+ [fun simple_get_stream/0,
+ fun three_level_tree_stream/0,
+ fun read_beyond_file_end/0,
+ fun partial_end_block_get_range/0,
+ fun partial_start_block_get_range/0,
+ fun partial_middle_block_get_range/0]}
+ ]
+ }
+ ]
+ }.
+
+simple_get_stream() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,3},{tree_order,3}], dict:new()),
{ok, _Written, File1} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklmnopqrstuvwxyz">>),
@@ -19,8 +39,8 @@ simple_get_stream_test() ->
?assertEqual({<<"yz">>, 24}, luwak_get_stream:recv(GetStream, 1000)),
?assertEqual(eos, luwak_get_stream:recv(GetStream, 1000))
end).
-
-three_level_tree_stream_test_() ->
+
+three_level_tree_stream() ->
Test = fun() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,2},{tree_order,2}], dict:new()),
@@ -37,7 +57,7 @@ three_level_tree_stream_test_() ->
end,
{timeout, 30000, Test}.
-read_beyond_file_end_test() ->
+read_beyond_file_end() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,2},{tree_order,2}], dict:new()),
{ok, _Written, File1} = luwak_io:put_range(Riak, File, 0, <<"abscdefghijklmnopqrstuvwxyz">>),
@@ -67,7 +87,7 @@ make_standard_range_file(Riak, Name, BlockSize, BlockCount) ->
%% the middle of a block
%% Ex: aaaaaaaaaa bbbbbbbbbb cccccccccc
%% ^start end^
-partial_end_block_get_range_test() ->
+partial_end_block_get_range() ->
test_helper:riak_test(
fun(Riak) ->
{ok, Data, File} = make_standard_range_file(
@@ -82,7 +102,7 @@ partial_end_block_get_range_test() ->
%% middle of a block
%% Ex: aaaaaaaaaa bbbbbbbbbb cccccccccc
%% ^start end^
-partial_start_block_get_range_test() ->
+partial_start_block_get_range() ->
test_helper:riak_test(
fun(Riak) ->
{ok, Data, File} = make_standard_range_file(
@@ -98,7 +118,7 @@ partial_start_block_get_range_test() ->
%% is unaligned with that block
%% Ex: aaaaaaaaaa bbbbbbbbbb cccccccccc
%% ^st end^
-partial_middle_block_get_range_test() ->
+partial_middle_block_get_range() ->
test_helper:riak_test(
fun(Riak) ->
{ok, Data, File} = make_standard_range_file(
@@ -118,3 +138,5 @@ read_stream(Stream, {Data, _}, Acc) ->
read_stream(Stream,
luwak_get_stream:recv(Stream, 1000),
[Data|Acc]).
+
+-endif.
View
51 test/luwak_io_tests.erl
@@ -1,8 +1,33 @@
-module(luwak_io_tests).
+-ifdef(TEST).
+
-include_lib("eunit/include/eunit.hrl").
-simple_put_range_test() ->
+io_test_() ->
+ {spawn,
+ [{setup,
+ fun test_helper:setup/0,
+ fun test_helper:cleanup/1,
+ [
+ {timeout, 60000,
+ [fun simple_put_range/0,
+ fun simple_get_range/0,
+ fun read_beyond_eof/0,
+ fun multilevel_get_range/0,
+ fun partial_end_block_get_range/0,
+ fun partial_start_block_get_range/0,
+ fun partial_middle_block_get_range/0,
+ fun eof_get_range/0,
+ fun truncate/0,
+ fun sub_block_partial_write/0,
+ fun overwrite_nonfull_block/0]}
+ ]
+ }
+ ]
+ }.
+
+simple_put_range() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,5}], dict:new()),
{ok, Written, _} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklm">>),
@@ -18,24 +43,24 @@ simple_put_range_test() ->
?assertEqual([{Hash1,5},{Hash2,5},{Hash3,3}], Written)
end).
-simple_get_range_test() ->
+simple_get_range() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,2},{tree_order,3}], dict:new()),
{ok, _Written, File1} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklm">>),
Blocks = luwak_io:get_range(Riak, File1, 3, 5),
ok = file:write_file("tree4.dot", luwak_tree:visualize_tree(Riak, luwak_file:get_property(File1, root))),
?assertEqual(<<"defgh">>, iolist_to_binary(Blocks))
end).
-
-read_beyond_eof_test() ->
+
+read_beyond_eof() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,2},{tree_order,3}], dict:new()),
{ok, _Written, File1} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklm">>),
Blocks = luwak_io:get_range(Riak, File1, 14, 5),
?assertEqual([], Blocks)
end).
-multilevel_get_range_test() ->
+multilevel_get_range() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,3},{tree_order,3}], dict:new()),
{ok, _Written, File1} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklmnopqrstuvwxyz">>),
@@ -66,7 +91,7 @@ make_standard_range_file(Riak, Name, BlockSize, BlockCount) ->
%% the middle of a block
%% Ex: aaaaaaaaaa bbbbbbbbbb cccccccccc
%% ^start end^
-partial_end_block_get_range_test() ->
+partial_end_block_get_range() ->
test_helper:riak_test(
fun(Riak) ->
{ok, Data, File} = make_standard_range_file(
@@ -81,7 +106,7 @@ partial_end_block_get_range_test() ->
%% middle of a block
%% Ex: aaaaaaaaaa bbbbbbbbbb cccccccccc
%% ^start end^
-partial_start_block_get_range_test() ->
+partial_start_block_get_range() ->
test_helper:riak_test(
fun(Riak) ->
{ok, Data, File} = make_standard_range_file(
@@ -96,7 +121,7 @@ partial_start_block_get_range_test() ->
%% is unaligned with that block
%% Ex: aaaaaaaaaa bbbbbbbbbb cccccccccc
%% ^st end^
-partial_middle_block_get_range_test() ->
+partial_middle_block_get_range() ->
test_helper:riak_test(
fun(Riak) ->
{ok, Data, File} = make_standard_range_file(
@@ -107,7 +132,7 @@ partial_middle_block_get_range_test() ->
?assertEqual(Expected, Read)
end).
-eof_get_range_test() ->
+eof_get_range() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,3},{tree_order,3}], dict:new()),
{ok, _Written, File1} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklmnopqrstuvwxyz">>),
@@ -116,7 +141,7 @@ eof_get_range_test() ->
?assertEqual(<<"uvwxyz">>, iolist_to_binary(Blocks))
end).
-truncate_test() ->
+truncate() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,3},{tree_order,3}], dict:new()),
{ok, _Written, File1} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklmnopqrstuvwxyz">>),
@@ -126,7 +151,7 @@ truncate_test() ->
?assertEqual(<<"abcdefg">>, iolist_to_binary(Blocks))
end).
-sub_block_partial_write_test() ->
+sub_block_partial_write() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"basho">>, [{block_size,1000}], dict:new()),
S = luwak_put_stream:start_link(Riak, File, 0, 1000),
@@ -148,7 +173,7 @@ sub_block_partial_write_test() ->
%% overwrite a file with more data than the file already had, but not
%% enough to touch the next block boundary
-overwrite_nonfull_block_test() ->
+overwrite_nonfull_block() ->
test_helper:riak_test(fun(Riak) ->
{ok, F0} = luwak_file:create(Riak,
<<"basho1">>,
@@ -170,3 +195,5 @@ overwrite_nonfull_block_test() ->
?debugFmt("blocks ~p~n", [Blocks]),
?assertEqual(<<"aa">>, iolist_to_binary(Blocks))
end).
+
+-endif.
View
22 test/luwak_put_stream_tests.erl
@@ -1,8 +1,24 @@
-module(luwak_put_stream_tests).
+-ifdef(TEST).
+
-include_lib("eunit/include/eunit.hrl").
-aligned_put_stream_test() ->
+put_stream_test_() ->
+ {spawn,
+ [{setup,
+ fun test_helper:setup/0,
+ fun test_helper:cleanup/1,
+ [
+ {timeout, 60000,
+ [fun aligned_put_stream/0,
+ fun unaligned_put_stream/0]}
+ ]
+ }
+ ]
+ }.
+
+aligned_put_stream() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,3},{tree_order,3}], dict:new()),
PutStream = luwak_put_stream:start(Riak, File, 0, 1000),
@@ -14,7 +30,7 @@ aligned_put_stream_test() ->
?assertEqual(<<"abcdefghijklmno">>, iolist_to_binary(Blocks))
end).
-unaligned_put_stream_test() ->
+unaligned_put_stream() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{block_size,3},{tree_order,3}], dict:new()),
{ok, _, File1} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklmno">>),
@@ -29,3 +45,5 @@ unaligned_put_stream_test() ->
timer:sleep(100),
?assertEqual(<<"abcdzyxwvutlmno">>, iolist_to_binary(Blocks))
end).
+
+-endif.
View
39 test/luwak_tree_tests.erl
@@ -1,9 +1,30 @@
-module(luwak_tree_tests).
+-ifdef(TEST).
+
-include_lib("eunit/include/eunit.hrl").
--include_lib("luwak.hrl").
+-include("luwak.hrl").
+
+tree_test_() ->
+ {spawn,
+ [{setup,
+ fun test_helper:setup/0,
+ fun test_helper:cleanup/1,
+ [
+ {timeout, 60000,
+ [fun create_simple_tree/0,
+ fun create_and_overwrite_middle_tree/0,
+ fun create_multilevel_tree/0,
+ fun create_and_overwrite_multilevel_tree/0,
+ fun create_and_append/0,
+ fun append_beyond_pointer/0,
+ fun block_at/0]}
+ ]
+ }
+ ]
+ }.
-create_simple_tree_test() ->
+create_simple_tree() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{tree_order,4},{block_size,5}], dict:new()),
{ok, _Written, File2} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklm">>),
@@ -18,7 +39,7 @@ create_simple_tree_test() ->
?assertEqual([{BHash1,5},{BHash2,5},{BHash3,3}], Children)
end).
-create_and_overwrite_middle_tree_test() ->
+create_and_overwrite_middle_tree() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{tree_order,4},{block_size,5}], dict:new()),
{ok, _Written1, File2} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklm">>),
@@ -34,7 +55,7 @@ create_and_overwrite_middle_tree_test() ->
?assertEqual([{BHash1_2,5},{BHash2_2,5},{BHash3,3}], Children)
end).
-create_multilevel_tree_test() ->
+create_multilevel_tree() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{tree_order,5},{block_size,1}], dict:new()),
{ok, _Written1, File2} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklm">>),
@@ -57,7 +78,7 @@ create_multilevel_tree_test() ->
?assertEqual(ThirdNodeChildren, Node3Node#n.children)
end).
-create_and_overwrite_multilevel_tree_test() ->
+create_and_overwrite_multilevel_tree() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{tree_order,5},{block_size,1}], dict:new()),
{ok, _Written1, File2} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklm">>),
@@ -83,7 +104,7 @@ create_and_overwrite_multilevel_tree_test() ->
?assertEqual(ThirdNodeChildren, Node3Node#n.children)
end).
-create_and_append_test() ->
+create_and_append() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{tree_order,3},{block_size,2}], dict:new()),
{ok, _Written1, File2} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklm">>),
@@ -93,15 +114,15 @@ create_and_append_test() ->
?assertEqual(<<"abcdefghijklmnopqrstuvwxyz">>, iolist_to_binary(luwak_io:get_range(Riak, File3, 0, 26)))
end).
-append_beyond_pointer_test() ->
+append_beyond_pointer() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{tree_order,3},{block_size,2}], dict:new()),
{ok, _Written1, File2} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklm">>),
{ok, _Written2, File3} = luwak_io:put_range(Riak, File2, 15, <<"nopqrstuvwxyz">>),
?assertEqual(<<"abcdefghijklmnopqrstuvwxyz">>, iolist_to_binary(luwak_io:get_range(Riak, File3, 0, 26)))
end).
-block_at_test() ->
+block_at() ->
test_helper:riak_test(fun(Riak) ->
{ok, File} = luwak_file:create(Riak, <<"file1">>, [{tree_order,3},{block_size,3}], dict:new()),
{ok, _Written1, File1} = luwak_io:put_range(Riak, File, 0, <<"abcdefghijklmno">>),
@@ -110,3 +131,5 @@ block_at_test() ->
timer:sleep(1000),
?assertEqual(<<"jkl">>, Data)
end).
+
+-endif.
View
7 test/luwak_tree_utils_tests.erl
@@ -1,7 +1,10 @@
-module(luwak_tree_utils_tests).
+-ifdef(TEST).
+
-include_lib("eunit/include/eunit.hrl").
--include_lib("luwak.hrl").
+-include("luwak.hrl").
+
left_list_larger_subtree_test() ->
A = [{a,100}, {b,50}, {c,200}],
@@ -108,3 +111,5 @@ subtree_split_test() ->
?assertEqual({{[{a,50},{b,50}],[{c,50}]},
{[{d,150}],[{e,100}]}},
luwak_tree_utils:shortest_subtree_split(ListA, ListB, 50, 0)).
+
+-endif.
View
41 test/test_helper.erl
@@ -1,6 +1,6 @@
-module(test_helper).
--export([riak_test/1]).
+-export([setup/0, cleanup/1, riak_test/1]).
-define(APPS,
[crypto,
@@ -18,32 +18,39 @@
riak_pipe,
riak_kv]).
+setup() ->
+ stop_riak(),
+ start_riak().
+
+cleanup(_) ->
+ stop_riak(),
+ net_kernel:stop().
+
riak_test(Fun) ->
- stop_riak(),
- start_riak(),
{ok, Riak} = riak:local_client(),
Ret = (catch Fun(Riak)),
case Ret of
{'EXIT', Err} -> throw(Err);
_ -> Ret
- end,
- net_kernel:stop().
+ end.
+
start_riak() ->
[] = os:cmd("epmd -daemon"),
case net_kernel:start([test_luwak, shortnames]) of
{ok,_} -> ok;
{error,{already_started,_}} -> ok
end,
- % Dir = "/tmp/ring-" ++ os:getpid(),
- % filelib:ensure_dir(Dir ++ "/"),
- % application:set_env(riak_core, ring_state_dir, Dir),
- application:set_env(riak_kv, storage_backend, riak_kv_cache_backend),
- error_logger:delete_report_handler(error_logger_tty_h),
- application:start(sasl),
- error_logger:delete_report_handler(sasl_report_tty_h),
- load_and_start_apps(?APPS).
-
+ application:set_env(riak_kv, storage_backend, riak_kv_cache_backend),
+ error_logger:delete_report_handler(error_logger_tty_h),
+ _ = application:load(sasl),
+ put(old_sasl_l, app_helper:get_env(sasl, sasl_error_logger)),
+ LogFile = "./luwak-eunit-sasl.log",
+ ok = application:set_env(sasl, sasl_error_logger, {file, LogFile}),
+ application:start(sasl),
+ error_logger:delete_report_handler(sasl_report_tty_h),
+ load_and_start_apps(?APPS).
+
stop_riak() ->
case whereis(riak_core_ring_manager) of
undefined ->
@@ -55,8 +62,10 @@ stop_riak() ->
Stop = fun(App) ->
application:stop(App)
end,
- lists:foreach(Stop, lists:reverse(?APPS)).
-
+ lists:foreach(Stop, lists:reverse(?APPS)),
+ application:stop(sasl),
+ application:set_env(sasl, sasl_error_logger, erase(old_sasl_l)).
+
load_and_start_apps([]) -> ok;
load_and_start_apps([App|Tail]) ->
ensure_loaded(App),

0 comments on commit 0314547

Please sign in to comment.
Something went wrong with that request. Please try again.