summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Doane <jaydoane@apache.org>2021-10-24 12:22:26 -0700
committerJay Doane <jay.s.doane@gmail.com>2021-10-25 12:05:51 -0700
commit8513c5bae1de0089e5909a51b7e15abf9af2196c (patch)
tree162f9dbc209edba42bee0bfbbf7fedd6311bcdeb
parent84d9234719f67dfeea0abd82d62ca0e50a03120f (diff)
downloadcouchdb-8513c5bae1de0089e5909a51b7e15abf9af2196c.tar.gz
Eliminate eunit compiler warnings
- Unused functions in `couch_util_tests` - Unused variables in `couch_prometheus_e2e_tests` - Unused variable in `dreyfus_blacklist_await_test` - Deprecated BIF `erlang:now/0` in `dreyfus_purge_test` - `export_all` flag in dreyfus tests - Unused variable in `mem3_reshard_test`
-rw-r--r--src/couch/test/eunit/couch_util_tests.erl18
-rw-r--r--src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl10
-rw-r--r--src/dreyfus/test/dreyfus_blacklist_await_test.erl4
-rw-r--r--src/dreyfus/test/dreyfus_purge_test.erl14
-rw-r--r--src/dreyfus/test/dreyfus_test_util.erl4
-rw-r--r--src/mem3/test/eunit/mem3_reshard_test.erl1
6 files changed, 18 insertions, 33 deletions
diff --git a/src/couch/test/eunit/couch_util_tests.erl b/src/couch/test/eunit/couch_util_tests.erl
index f6d7d958a..44a5cce0a 100644
--- a/src/couch/test/eunit/couch_util_tests.erl
+++ b/src/couch/test/eunit/couch_util_tests.erl
@@ -15,24 +15,6 @@
-include_lib("couch/include/couch_eunit.hrl").
-setup() ->
- %% We cannot start driver from here since it becomes bounded to eunit
- %% master process and the next couch_server_sup:start_link call will
- %% fail because server couldn't load driver since it already is.
- %%
- %% On other hand, we cannot unload driver here due to
- %% {error, not_loaded_by_this_process} while it is. Any ideas is welcome.
- %%
- Ctx = test_util:start_couch(),
- %% config:start_link(?CONFIG_CHAIN),
- Ctx.
-
-teardown(Ctx) ->
- ok = test_util:stop_couch(Ctx),
- %% config:stop(),
- ok.
-
-
validate_callback_exists_test_() ->
{
"validate_callback_exists tests",
diff --git a/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl b/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl
index c862b9a9f..5b8adfd1d 100644
--- a/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl
+++ b/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl
@@ -85,17 +85,15 @@ node_call_prometheus_http(_) ->
Url = construct_url(?PROM_PORT),
{ok, RC1, _, _} = test_request:get(
Url,
- [?CONTENT_JSON, ?AUTH],
- []
+ [?CONTENT_JSON, ?AUTH]
),
% since this port doesn't require auth, this should work
{ok, RC2, _, _} = test_request:get(
Url,
- [?CONTENT_JSON],
- []
+ [?CONTENT_JSON]
),
delete_db(Url),
- ?_assertEqual(200, RC2).
+ ?_assertEqual({200, 200}, {RC1, RC2}).
% we don't start the http server
deny_prometheus_http(_) ->
@@ -121,8 +119,6 @@ construct_url(Port) ->
lists:concat(["http://", Addr, ":", Port, "/_node/_local/_prometheus"]).
create_db(Url) ->
- Addr = config:get("chttpd", "bind_address", "127.0.0.1"),
- Port = mochiweb_socket_server:get(chttpd, port),
{ok, Status, _, _} = test_request:put(Url, [?CONTENT_JSON, ?AUTH], "{}"),
?assert(Status =:= 201 orelse Status =:= 202).
diff --git a/src/dreyfus/test/dreyfus_blacklist_await_test.erl b/src/dreyfus/test/dreyfus_blacklist_await_test.erl
index 28a5e7f30..82665eb02 100644
--- a/src/dreyfus/test/dreyfus_blacklist_await_test.erl
+++ b/src/dreyfus/test/dreyfus_blacklist_await_test.erl
@@ -62,8 +62,8 @@ do_not_await_1() ->
State = create_state(?DBNAME, Index, nil, nil, []),
Msg = "Index Blocked from Updating - db: ~p, ddocid: ~p name: ~p",
Return = wait_log_message(Msg, fun() ->
- {noreply, NewState} = dreyfus_index:handle_call({await, 1},
- self(), State)
+ {noreply, _NewState} = dreyfus_index:handle_call({await, 1},
+ self(), State)
end),
?assertEqual(Return, ok).
diff --git a/src/dreyfus/test/dreyfus_purge_test.erl b/src/dreyfus/test/dreyfus_purge_test.erl
index 5fa4bc90f..9b24d6f64 100644
--- a/src/dreyfus/test/dreyfus_purge_test.erl
+++ b/src/dreyfus/test/dreyfus_purge_test.erl
@@ -27,6 +27,8 @@
test_local_doc/0, test_delete_local_doc/0, test_purge_search/0]).
-compile(export_all).
+-compile(nowarn_export_all).
+
test_all() ->
test_purge_single(),
@@ -703,10 +705,14 @@ test_purge_search() ->
%private API
db_name() ->
- Nums = tuple_to_list(erlang:now()),
- Prefix = "test-db",
- Suffix = lists:concat([integer_to_list(Num) || Num <- Nums]),
- list_to_binary(Prefix ++ "-" ++ Suffix).
+ iolist_to_binary([
+ "dreyfus-test-db-", [
+ integer_to_list(I) || I <- [
+ erlang:unique_integer([positive]),
+ rand:uniform(10000)
+ ]
+ ]
+ ]).
purge_docs(DBName, DocIds) ->
IdsRevs = [{DocId, [get_rev(DBName, DocId)]} || DocId <- DocIds],
diff --git a/src/dreyfus/test/dreyfus_test_util.erl b/src/dreyfus/test/dreyfus_test_util.erl
index 631bc1047..79fd9b59d 100644
--- a/src/dreyfus/test/dreyfus_test_util.erl
+++ b/src/dreyfus/test/dreyfus_test_util.erl
@@ -1,6 +1,8 @@
-module(dreyfus_test_util).
--compile(export_all).
+-export([
+ wait_config_change/2
+]).
-include_lib("couch/include/couch_db.hrl").
diff --git a/src/mem3/test/eunit/mem3_reshard_test.erl b/src/mem3/test/eunit/mem3_reshard_test.erl
index 1122590ae..65f2b4bb0 100644
--- a/src/mem3/test/eunit/mem3_reshard_test.erl
+++ b/src/mem3/test/eunit/mem3_reshard_test.erl
@@ -519,7 +519,6 @@ target_reset_in_initial_copy(#{db1 := Db}) ->
split_an_incomplete_shard_map(#{db1 := Db}) ->
{timeout, ?TIMEOUT, ?_test(begin
- [#shard{} = Src] = lists:sort(mem3:local_shards(Db)),
[#shard{name=Shard}] = lists:sort(mem3:local_shards(Db)),
meck:expect(mem3_util, calculate_max_n, 1, 0),
?assertMatch({error, {not_enough_shard_copies, _}},