summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Doane <jay.s.doane@gmail.com>2018-12-12 22:00:48 -0800
committerJay Doane <jay.s.doane@gmail.com>2018-12-27 13:07:57 -0800
commit899b49c572847d9b05d457c1919b883d4a0c0305 (patch)
tree308300e061f4e9b59183a032e02789f409f3e031
parentf29cdb49cac99f82c46aaadd69a6f70b8df4ed53 (diff)
downloadcouchdb-899b49c572847d9b05d457c1919b883d4a0c0305.tar.gz
Reduce number of behaviour undefined compiler warnings
Move couch_event and mem3 modules earlier in the list of SubDirs to suppress behaviour undefined warnings. This has the side effect of running the tests in the new order, which induces failures in couch_index tests. Those failures are related to quorum, and can be traced to mem3 seeds tests leaving a _nodes db containing several node docs in the tmp/data directory, ultimately resulting in badmatch errors e.g. when a test expects 'ok' but gets 'accepted' instead. To prevent test failures, a cleanup function is implemented which deletes any existing "nodes_db" left after test completion.
-rw-r--r--rebar.config.script4
-rw-r--r--src/mem3/test/mem3_seeds_test.erl13
2 files changed, 11 insertions, 6 deletions
diff --git a/rebar.config.script b/rebar.config.script
index 5f17c29e0..85cc20f88 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -27,12 +27,13 @@ SubDirs = [
"src/couch_log",
"src/chttpd",
"src/couch",
+ "src/couch_event",
+ "src/mem3",
"src/couch_index",
"src/couch_mrview",
"src/couch_replicator",
"src/couch_plugins",
"src/couch_pse_tests",
- "src/couch_event",
"src/couch_stats",
"src/couch_peruser",
"src/couch_tests",
@@ -40,7 +41,6 @@ SubDirs = [
"src/fabric",
"src/global_changes",
"src/mango",
- "src/mem3",
"src/rexi",
"src/setup",
"rel"
diff --git a/src/mem3/test/mem3_seeds_test.erl b/src/mem3/test/mem3_seeds_test.erl
index 19e007950..ba83b66be 100644
--- a/src/mem3/test/mem3_seeds_test.erl
+++ b/src/mem3/test/mem3_seeds_test.erl
@@ -12,7 +12,7 @@
-module(mem3_seeds_test).
--include_lib("eunit/include/eunit.hrl").
+-include_lib("couch/include/couch_eunit.hrl").
a_test_() ->
Tests = [
@@ -29,7 +29,7 @@ empty_seedlist_status_ok() ->
?assertEqual({[]}, couch_util:get_value(seeds, Result)),
?assertEqual(ok, couch_util:get_value(status, Result))
after
- application:stop(mem3)
+ cleanup()
end.
seedlist_misconfiguration() ->
@@ -43,7 +43,7 @@ seedlist_misconfiguration() ->
?assertMatch({_}, couch_util:get_value('couchdb@node2.example.com', Seeds)),
?assertEqual(seeding, couch_util:get_value(status, Result))
after
- application:stop(mem3)
+ cleanup()
end.
check_nodelist() ->
@@ -54,9 +54,14 @@ check_nodelist() ->
?assert(lists:member('couchdb@node1.example.com', Nodes)),
?assert(lists:member('couchdb@node2.example.com', Nodes))
after
- application:stop(mem3)
+ cleanup()
end.
+cleanup() ->
+ application:stop(mem3),
+ Filename = config:get("mem3", "nodes_db", "_nodes") ++ ".couch",
+ file:delete(filename:join([?BUILDDIR(), "tmp", "data", Filename])).
+
setup() ->
test_util:start_couch([rexi]).