Skip to content

Commit

Permalink
Exclude complex distributed tests from Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
schlagert committed Nov 11, 2015
1 parent ca69333 commit 9cf9f97
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
language: erlang
script:
- rebar compile -DDEBUG
- rebar skip_deps=true eunit -DDEBUG -DTRAVIS_CI
otp_release:
- 17.1
- 17.0
23 changes: 16 additions & 7 deletions test/lbm_kv_dist_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,19 @@ all_test_() ->
{foreach, setup(), teardown(),
[
{timeout, 10, [fun unique_table/0]},
{timeout, 10, [fun simple_netsplit/0]},
{timeout, 10, [fun simple_netsplit/0]}
]}.

-ifndef(TRAVIS_CI).

additional_test_() ->
{foreach, setup(), teardown(),
[
{timeout, 10, [fun resolve_conflict/0]}
]}.

-endif.

unique_table() ->
process_flag(trap_exit, true),

Expand Down Expand Up @@ -167,6 +176,7 @@ simple_netsplit() ->

ok.

%% Due to race conditions this test may sometimes produce false positives.
resolve_conflict() ->
process_flag(trap_exit, true),

Expand All @@ -183,7 +193,7 @@ resolve_conflict() ->
?assertEqual(ok, slave_execute(Slave2, Create)),

%% Put the key from local node
PutKey = fun() -> {ok, _} = lbm_kv:put(?MODULE, key, node()) end,
PutKey = fun() -> {ok, _} = lbm_kv:put(?MODULE, key, value) end,
PutKey(),

%% Ensure the key from slaves
Expand All @@ -198,7 +208,6 @@ resolve_conflict() ->
{ok, _} = mnesia:subscribe(system),
true = net_kernel:disconnect(OtherSlave),

PutKey(),
PutOther(),

true = net_kernel:connect(OtherSlave),
Expand All @@ -210,7 +219,7 @@ resolve_conflict() ->
%% sorry, but there's no event we can wait for...
timer:sleep(1000),

GetKey = fun() -> {ok, _} = lbm_kv:get(?MODULE, key) end,
GetKey = fun() -> {ok, [{key, value}]} = lbm_kv:get(?MODULE, key) end,
GetKey(),
ok = slave_execute(Slave1, GetKey),
ok = slave_execute(Slave2, GetKey),
Expand All @@ -222,9 +231,9 @@ resolve_conflict() ->

ok.

%% custome conflict resolution for resolve_conflict/0 test.
resolve_conflict(key, _Local, _Remote) ->
delete;
%% custom conflict resolution for resolve_conflict/0 test.
resolve_conflict(key, _Local, Remote) ->
{value, Remote};
resolve_conflict(other, _Local, _Remote) ->
{value, new}.

Expand Down

0 comments on commit 9cf9f97

Please sign in to comment.