Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
shino committed Jul 16, 2015
1 parent 6c6735b commit bfe6871
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/riak_cs_stats.erl
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ stats_test_() ->
Apps = [setup, compiler, syntax_tools, goldrush, lager, exometer_core],
{setup,
fun() ->
[ok = application:start(App) || App <- Apps],
application:set_env(lager, handlers, []),
[catch (application:start(App)) || App <- Apps],
ok = init()
end,
fun(_) ->
Expand Down
17 changes: 11 additions & 6 deletions test/riak_cs_gc_single_run_eqc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
eqc_test_() ->
{foreach,
fun() ->
application:set_env(lager, handlers, []),
exometer:start(),
riak_cs_stats:init(),

application:set_env(riak_cs, gc_batch_size, 7),
meck:new(riak_cs_gc_manager, []),

Expand All @@ -77,7 +81,8 @@ eqc_test_() ->
end,
fun(_) ->
meck:unload(),
stop_and_wait_for_gc_batch()
stop_and_wait_for_gc_batch(),
exometer:stop()
end,
[
{timeout, ?TESTING_TIME*2,
Expand Down Expand Up @@ -321,11 +326,11 @@ dummy_start_delete_fsm(_Node, [_RcPid, {_UUID, ?MANIFEST{bkey={_, K}}=_Manifest}
%% ====================================================================
meck_fileset_get_and_delete() ->
meck:new(riak_cs_pbc, [passthrough]),
meck:expect(riak_cs_pbc, get_object, fun dummy_get_object/4),
meck:expect(riak_cs_pbc, get, fun dummy_get/6),
meck:expect(riakc_pb_socket, is_connected, fun always_true/1),
meck:expect(riakc_pb_socket, delete_obj, fun dummy_delete_object/4).
meck:expect(riak_cs_pbc, delete_obj, fun dummy_delete_obj/5).

dummy_get_object(_Pbc, <<"riak-cs-gc">>=B, K, _Opt) ->
dummy_get(_Pbc, <<"riak-cs-gc">>=B, K, _Opt, _Timeout, _StatsKey) ->
case re:run(K, <<"^error:in_fileset_fetch/">>) of
nomatch ->
{ok, riakc_obj:new_obj(B, K, vclock,
Expand All @@ -334,12 +339,12 @@ dummy_get_object(_Pbc, <<"riak-cs-gc">>=B, K, _Opt) ->
{match, _} ->
{error, {dummy_error, in_fileset_fetch}}
end;
dummy_get_object(_Pbc, _B, _K, _Opt) ->
dummy_get(_Pbc, _B, _K, _Opt, _Timeout, _StatsKey) ->
error.

always_true(_) -> true.

dummy_delete_object(_Pbc, RiakObj, _Opts, _Timeout) ->
dummy_delete_obj(_Pbc, RiakObj, _Opts, _Timeout, _StatsKey) ->
Key = riakc_obj:key(RiakObj),
case re:run(Key, <<"^error:in_block_delete/">>) of
nomatch ->
Expand Down
4 changes: 4 additions & 0 deletions test/riak_cs_list_objects_fsm_v2_eqc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@ eqc_test_() ->
setup() ->
error_logger:tty(false),
error_logger:logfile({open, "riak_cs_list_objects_fsm_v2_eqc.log"}),
application:set_env(lager, handlers, []),
exometer:start(),
riak_cs_stats:init(),
ok.

cleanup(_) ->
exometer:stop(),
ok.

%% ====================================================================
Expand Down

6 comments on commit bfe6871

@kuenishi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from kuenishi
at bfe6871

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging basho/riak_cs/feature/stats-for-riak-pb-client = bfe6871 into borshop-integration-1189-feature/stats-for-riak-pb-client

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basho/riak_cs/feature/stats-for-riak-pb-client = bfe6871 merged ok, testing candidate = 71b0916

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding develop to borshop-integration-1189-feature/stats-for-riak-pb-client = 71b0916

Please sign in to comment.