From a383c9492e5b538f16cef6ac1bc465bc39c9beff Mon Sep 17 00:00:00 2001 From: Antonio Nikishaev Date: Sat, 23 Mar 2019 19:03:24 +0400 Subject: [PATCH 1/2] tests + otp20 --- rebar.config | 4 +++- tests/jmx_verify.erl | 6 +++--- tests/loaded_upgrade.erl | 8 ++++---- tests/pb_cipher_suites.erl | 2 +- tests/replication2_pg.erl | 16 ++++++++-------- tests/verify_2i_aae.erl | 2 +- tests/verify_aae.erl | 2 +- tests/verify_counter_repl.erl | 2 +- tests/verify_put_opt_node_confirms.erl | 2 +- tests/verify_tictac_aae.erl | 2 +- 10 files changed, 24 insertions(+), 22 deletions(-) diff --git a/rebar.config b/rebar.config index 84c07860d..0fe0be452 100644 --- a/rebar.config +++ b/rebar.config @@ -1,4 +1,4 @@ -{require_otp_vsn, "R16|17|18|19|20"}. +{minimum_otp_vsn, "20"}. {cover_enabled, true}. {edoc_opts, [{preprocess, true}]}. %%{edoc_opts, [{doclet, edown_doclet}, {pretty_printer, erl_pp}]}. @@ -26,6 +26,8 @@ {escript_incl_apps, [goldrush, lager, getopt, riakhttpc, riakc, ibrowse, mochiweb, kvc, kv_index_tictactree]}. {escript_emu_args, "%%! -escript main riak_test_escript +K true +P 10000 -env ERL_MAX_PORTS 10000\n"}. +{extra_src_dirs, ["tests"]}. + {post_hooks, [{"(linux|darwin|solaris|freebsd|netbsd|openbsd)", escriptize, "cp \"$REBAR_BUILD_DIR/bin/riak_test\" ./riak_test"}, diff --git a/tests/jmx_verify.erl b/tests/jmx_verify.erl index 17f37eb02..a9a6d828c 100644 --- a/tests/jmx_verify.erl +++ b/tests/jmx_verify.erl @@ -128,7 +128,7 @@ test_supervision() -> case net_adm:ping(Node) of pang -> lager:error("riak_jmx crash able to crash riak node"), - ?assertEqual("riak_jmx crash able to crash riak node", true); + ?assert(false, "riak_jmx crash able to crash riak node"); _ -> yay end, @@ -186,7 +186,7 @@ test_application_stop() -> case net_adm:ping(Node) of pang -> lager:error("riak_jmx stop takes down riak node"), - ?assertEqual("riak_jmx stop takes down riak node", true); + ?assert(false, "riak_jmx stop takes down riak node"); _ -> yay end, @@ -225,4 +225,4 @@ jmx_dump(Cmd) -> lager:info("Dumping JMX stats using command ~s", [Cmd]), Output = string:strip(os:cmd(Cmd), both, $\n), JSONOutput = mochijson2:decode(Output), - [ {Key, Value} || {struct, [{Key, Value}]} <- JSONOutput]. \ No newline at end of file + [ {Key, Value} || {struct, [{Key, Value}]} <- JSONOutput]. diff --git a/tests/loaded_upgrade.erl b/tests/loaded_upgrade.erl index 4b41e3283..8f16c368d 100644 --- a/tests/loaded_upgrade.erl +++ b/tests/loaded_upgrade.erl @@ -94,13 +94,13 @@ upgrade_recv_loop(EndTime) -> _ -> receive {mapred, Node, bad_result} -> - ?assertEqual(true, {mapred, Node, bad_result}); + ?assert(false, {mapred, Node, bad_result}); {kv, Node, not_equal} -> - ?assertEqual(true, {kv, Node, bad_result}); + ?assert(false, {kv, Node, bad_result}); {kv, Node, {notfound, Key}} -> - ?assertEqual(true, {kv, Node, {notfound, Key}}); + ?assert(false, {kv, Node, {notfound, Key}}); {listkeys, Node, not_equal} -> - ?assertEqual(true, {listkeys, Node, not_equal}); + ?assert(false, {listkeys, Node, not_equal}); Msg -> lager:debug("Received Mesg ~p", [Msg]), upgrade_recv_loop(EndTime) diff --git a/tests/pb_cipher_suites.erl b/tests/pb_cipher_suites.erl index 5618c89e2..48e839b68 100644 --- a/tests/pb_cipher_suites.erl +++ b/tests/pb_cipher_suites.erl @@ -219,7 +219,7 @@ pb_connection_info(Port, Config) -> {ok, PB} = riakc_pb_socket:start("127.0.0.1", Port, Config), ?assertEqual(pong, riakc_pb_socket:ping(PB)), - ConnInfo = ssl:connection_info(pb_get_socket(PB)), + ConnInfo = ssl:connection_information(pb_get_socket(PB)), riakc_pb_socket:stop(PB), ConnInfo. diff --git a/tests/replication2_pg.erl b/tests/replication2_pg.erl index 6e54a80e0..b01345106 100644 --- a/tests/replication2_pg.erl +++ b/tests/replication2_pg.erl @@ -182,7 +182,7 @@ test_basic_pg(Mode, SSL) -> rt:pbc_write(PidA, Bucket, KeyA, ValueA), rt:pbc_write(PidA, Bucket, KeyB, ValueB), - _FirstA = hd(ANodes), + _ = hd(ANodes), FirstB = hd(BNodes), FirstC = hd(CNodes), PidB = rt:pbc(FirstB), @@ -286,9 +286,9 @@ test_12_pg(Mode, SSL) -> {Bucket, KeyB, ValueB} = make_test_object("b"), rt:log_to_nodes(AllNodes, "Test 1.2 proxy_get"), - _FirstA = hd(ANodes), + _ = hd(ANodes), FirstB = hd(BNodes), - _FirstC = hd(CNodes), + _ = hd(CNodes), case Mode of mode_repl12 -> ModeRes = rpc:call(FirstB, riak_repl_console, modes, [["mode_repl12"]]), @@ -406,7 +406,7 @@ test_pg_proxy(SSL) -> %% before it actually does any work. FirstA = hd(ANodes), FirstB = hd(BNodes), - _FirstC = hd(CNodes), + _ = hd(CNodes), PidB = rt:pbc(FirstB), lager:info("Connected to cluster B"), {ok, PGResult} = riak_repl_pb_api:get(PidB,Bucket,KeyA,CidA), @@ -453,7 +453,7 @@ test_cluster_mapping(SSL) -> {LeaderA, ANodes, BNodes, CNodes, _AllNodes} = setup_repl_clusters(Conf, SSL), - _FirstA = hd(ANodes), + _ = hd(ANodes), FirstB = hd(BNodes), FirstC = hd(CNodes), LeaderB = rpc:call(FirstB, riak_core_cluster_mgr, get_leader, []), @@ -576,7 +576,7 @@ test_bidirectional_pg(SSL) -> FirstA = hd(ANodes), FirstB = hd(BNodes), - _FirstC = hd(CNodes), + _ = hd(CNodes), LeaderB = rpc:call(FirstB, riak_repl2_leader, leader_node, []), @@ -677,7 +677,7 @@ test_multiple_sink_pg(SSL) -> rt:pbc_write(PidA, Bucket, KeyA, ValueA), rt:pbc_write(PidA, Bucket, KeyB, ValueB), - _FirstA = hd(ANodes), + _ = hd(ANodes), FirstB = hd(BNodes), FirstC = hd(CNodes), @@ -730,7 +730,7 @@ test_mixed_pg(SSL) -> rt:pbc_write(PidA, Bucket, KeyB, ValueB), rt:pbc_write(PidA, Bucket, KeyC, ValueC), - _FirstA = hd(ANodes), + _ = hd(ANodes), FirstB = hd(BNodes), FirstC = hd(CNodes), rt:wait_until_ring_converged(ANodes), diff --git a/tests/verify_2i_aae.erl b/tests/verify_2i_aae.erl index 0c2ecfc1c..959a7f057 100644 --- a/tests/verify_2i_aae.erl +++ b/tests/verify_2i_aae.erl @@ -179,7 +179,7 @@ run_2i_repair(Node1) -> after MaxWaitTime -> lager:error("Timed out (~pms) waiting for 2i AAE repair process", [MaxWaitTime]), - ?assertEqual(aae_2i_repair_complete, aae_2i_repair_timeout) + ?assert(false, {aae_2i_repair_complete,aae_2i_repair_timeout}) end. set_skip_index_specs(Node, Val) -> diff --git a/tests/verify_aae.erl b/tests/verify_aae.erl index ee1bbc87f..dbb419d77 100644 --- a/tests/verify_aae.erl +++ b/tests/verify_aae.erl @@ -207,7 +207,7 @@ verify_data(Node, KeyValues) -> lager:info("Data is now correct. Yay!"); fail -> lager:error("AAE failed to fix data"), - ?assertEqual(aae_fixed_data, aae_failed_to_fix_data) + ?assert(false, aae_failed_to_fix_data) end, riakc_pb_socket:stop(PB), ok. diff --git a/tests/verify_counter_repl.erl b/tests/verify_counter_repl.erl index f16e83eaf..688cd1144 100644 --- a/tests/verify_counter_repl.erl +++ b/tests/verify_counter_repl.erl @@ -89,7 +89,7 @@ verify_counter(ExpectedValue, Node) -> ExpectedValue == get_counter(Node). rand_amt() -> - crypto:rand_uniform(-100, 100). + -100 + rand:uniform(100*2). %% Set up bi-directional full sync replication. repl_power_activate(ClusterA, ClusterB) -> diff --git a/tests/verify_put_opt_node_confirms.erl b/tests/verify_put_opt_node_confirms.erl index 6e81393ca..5d823f7fe 100644 --- a/tests/verify_put_opt_node_confirms.erl +++ b/tests/verify_put_opt_node_confirms.erl @@ -229,4 +229,4 @@ new_bucket(Bucket) when is_binary(Bucket) -> %% string like random bytes random_char() -> - <<(crypto:rand_uniform(65, 90))>>. + <<(rand:uniform(65, 90))>>. diff --git a/tests/verify_tictac_aae.erl b/tests/verify_tictac_aae.erl index 99630bd95..d261721a5 100644 --- a/tests/verify_tictac_aae.erl +++ b/tests/verify_tictac_aae.erl @@ -220,7 +220,7 @@ verify_data(Node, KeyValues) -> lager:info("Data is now correct. Yay!"); fail -> lager:error("AAE failed to fix data"), - ?assertEqual(aae_fixed_data, aae_failed_to_fix_data) + ?assert(false, aae_failed_to_fix_data) end, riakc_pb_socket:stop(PB), ok. From d47376585e808bcf06acdbe01c7abc15952a9e5d Mon Sep 17 00:00:00 2001 From: Antonio Nikishaev Date: Mon, 1 Apr 2019 20:39:55 +0400 Subject: [PATCH 2/2] =?UTF-8?q?overload=20=E2=86=92=20overload=5Fprotectio?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit because https://bugs.erlang.org/browse/ERL-904 --- groups/kv | 2 +- groups/kv_all | 2 +- tests/{overload.erl => overload_protection.erl} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename tests/{overload.erl => overload_protection.erl} (99%) diff --git a/groups/kv b/groups/kv index c815a759b..81f98bb9c 100644 --- a/groups/kv +++ b/groups/kv @@ -1,7 +1,7 @@ loaded_upgrade riak727 verify_riak_object_reformat -overload +overload_protection riak_rex verify_riak_stats partition_repair diff --git a/groups/kv_all b/groups/kv_all index 020e28cec..ffcfd5e80 100644 --- a/groups/kv_all +++ b/groups/kv_all @@ -7,7 +7,7 @@ kv679_tombstone kv679_tombstone2 kv679_uid node_confirms_vs_pw -overload +overload_protection partition_repair pb_cipher_suites pb_security diff --git a/tests/overload.erl b/tests/overload_protection.erl similarity index 99% rename from tests/overload.erl rename to tests/overload_protection.erl index 678b1d30d..137f3eb6e 100644 --- a/tests/overload.erl +++ b/tests/overload_protection.erl @@ -17,7 +17,7 @@ %% under the License. %% %% ------------------------------------------------------------------- --module(overload). +-module(overload_protection). -compile([export_all, nowarn_export_all]). -include_lib("eunit/include/eunit.hrl").