summaryrefslogtreecommitdiff
path: root/src/mem3/test/eunit/mem3_seeds_test.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem3/test/eunit/mem3_seeds_test.erl')
-rw-r--r--src/mem3/test/eunit/mem3_seeds_test.erl69
1 files changed, 0 insertions, 69 deletions
diff --git a/src/mem3/test/eunit/mem3_seeds_test.erl b/src/mem3/test/eunit/mem3_seeds_test.erl
deleted file mode 100644
index ba83b66be..000000000
--- a/src/mem3/test/eunit/mem3_seeds_test.erl
+++ /dev/null
@@ -1,69 +0,0 @@
-% Licensed under the Apache License, Version 2.0 (the "License"); you may not
-% use this file except in compliance with the License. You may obtain a copy of
-% the License at
-%
-% http://www.apache.org/licenses/LICENSE-2.0
-%
-% Unless required by applicable law or agreed to in writing, software
-% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-% License for the specific language governing permissions and limitations under
-% the License.
-
--module(mem3_seeds_test).
-
--include_lib("couch/include/couch_eunit.hrl").
-
-a_test_() ->
- Tests = [
- {"empty seedlist should set status ok", fun empty_seedlist_status_ok/0},
- {"all seedlist nodes unreachable keeps status seeding", fun seedlist_misconfiguration/0},
- {"seedlist entries should be present in _nodes", fun check_nodelist/0}
- ],
- {setup, fun setup/0, fun teardown/1, Tests}.
-
-empty_seedlist_status_ok() ->
- ok = application:start(mem3),
- try
- {ok, {Result}} = mem3_seeds:get_status(),
- ?assertEqual({[]}, couch_util:get_value(seeds, Result)),
- ?assertEqual(ok, couch_util:get_value(status, Result))
- after
- cleanup()
- end.
-
-seedlist_misconfiguration() ->
- config:set("cluster", "seedlist", "couchdb@node1.example.com,couchdb@node2.example.com", false),
- ok = application:start(mem3),
- try
- {ok, {Result}} = mem3_seeds:get_status(),
- {Seeds} = couch_util:get_value(seeds, Result),
- ?assertEqual(2, length(Seeds)),
- ?assertMatch({_}, couch_util:get_value('couchdb@node1.example.com', Seeds)),
- ?assertMatch({_}, couch_util:get_value('couchdb@node2.example.com', Seeds)),
- ?assertEqual(seeding, couch_util:get_value(status, Result))
- after
- cleanup()
- end.
-
-check_nodelist() ->
- config:set("cluster", "seedlist", "couchdb@node1.example.com,couchdb@node2.example.com", false),
- ok = application:start(mem3),
- try
- Nodes = mem3:nodes(),
- ?assert(lists:member('couchdb@node1.example.com', Nodes)),
- ?assert(lists:member('couchdb@node2.example.com', Nodes))
- after
- 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]).
-
-teardown(Ctx) ->
- test_util:stop_couch(Ctx).