Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'klm-refactor-tests'

  • Loading branch information...
commit a1fa6eef1cd6e29b8d5f4641525b3787b4a0ffb6 2 parents e7829da + c97b2d3
Kelly McLaughlin kellymclaughlin authored
16 include/luwak.hrl
View
@@ -12,7 +12,21 @@
-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.
+
+-else.
-ifdef(DEBUG).
-define(debugMsg(S), error_logger:info_msg(S)).
2  src/luwak_block.erl
View
@@ -1,6 +1,6 @@
-module(luwak_block).
--include_lib("luwak.hrl").
+-include("luwak.hrl").
-export([create/2,
data/1,
2  src/luwak_file.erl
View
@@ -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()}
3  src/luwak_get_stream.erl
View
@@ -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()) ->
2  src/luwak_io.erl
View
@@ -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()) ->
2  src/luwak_put_stream.erl
View
@@ -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,
2  src/luwak_tree.erl
View
@@ -9,7 +9,7 @@
truncate/7,
truncate/1]).
--include_lib("luwak.hrl").
+-include("luwak.hrl").
%%=======================================
%% Public API
2  src/luwak_tree_utils.erl
View
@@ -1,6 +1,6 @@
-module(luwak_tree_utils).
--include_lib("luwak.hrl").
+-include("luwak.hrl").
-export([longest_divisable_subtree/2,
longest_divisable_subtree/4,
2  src/luwak_wm_file.erl
View
@@ -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").
22 test/luwak_checksum_tests.erl
View
@@ -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.
35 test/luwak_file_tests.erl
View
@@ -1,17 +1,35 @@
-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)),
@@ -19,17 +37,18 @@ set_attributes_test() ->
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.
36 test/luwak_get_stream_tests.erl
View
@@ -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.
51 test/luwak_io_tests.erl
View
@@ -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,7 +43,7 @@ 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">>),
@@ -26,8 +51,8 @@ simple_get_range_test() ->
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">>),
@@ -35,7 +60,7 @@ read_beyond_eof_test() ->
?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.
22 test/luwak_put_stream_tests.erl
View
@@ -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.
39 test/luwak_tree_tests.erl
View
@@ -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,7 +114,7 @@ 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">>),
@@ -101,7 +122,7 @@ append_beyond_pointer_test() ->
?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.
7 test/luwak_tree_utils_tests.erl
View
@@ -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.
41 test/test_helper.erl
View
@@ -1,6 +1,6 @@
-module(test_helper).
--export([riak_test/1]).
+-export([setup/0, cleanup/1, riak_test/1]).
-define(APPS,
[crypto,
@@ -18,16 +18,22 @@
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"),
@@ -35,15 +41,16 @@ start_riak() ->
{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),
Please sign in to comment.
Something went wrong with that request. Please try again.