From 9f6abc8972865d5fc3f9f2b55966d53ffc718861 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi <16166434+thalesmg@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:26:49 -0300 Subject: [PATCH] test: fix several unused variable warnings --- apps/emqx/test/emqx_persistent_session_ds_SUITE.erl | 6 ++---- .../test/emqx_bridge_kafka_impl_consumer_SUITE.erl | 3 --- .../test/emqx_bridge_v2_mongodb_SUITE.erl | 8 -------- .../emqx_bridge_mysql/test/emqx_bridge_v2_mysql_SUITE.erl | 1 - .../test/emqx_cluster_link_schema_tests.erl | 3 --- apps/emqx_ds_backends/test/emqx_ds_backends_SUITE.erl | 8 ++++---- apps/emqx_durable_storage/src/emqx_ds_beamformer.erl | 1 - .../emqx_durable_storage/src/emqx_durable_storage.app.src | 2 +- apps/emqx_resource/test/emqx_connector_demo.erl | 2 +- 9 files changed, 8 insertions(+), 26 deletions(-) diff --git a/apps/emqx/test/emqx_persistent_session_ds_SUITE.erl b/apps/emqx/test/emqx_persistent_session_ds_SUITE.erl index a593acaa47f..778e82f2a35 100644 --- a/apps/emqx/test/emqx_persistent_session_ds_SUITE.erl +++ b/apps/emqx/test/emqx_persistent_session_ds_SUITE.erl @@ -429,7 +429,6 @@ t_session_unsubscription_idempotency(Config) -> %% This testcase verifies that the session handles update of the %% subscription settings by the client correctly. t_subscription_state_change(Config) -> - [Node1Spec | _] = ?config(node_specs, Config), [Node1] = ?config(nodes, Config), Port = get_mqtt_port(Node1, tcp), TopicFilter = <<"t/+">>, @@ -484,7 +483,7 @@ t_subscription_state_change(Config) -> ok = emqtt:puback(Sub, PI1), {ok, _} = emqtt:publish(Pub, <<"t/1">>, <<"2">>, ?QOS_2), %% Verify that QoS of subscription has been updated: - [#{packet_id := PI2, qos := ?QOS_2, topic := <<"t/1">>, payload := <<"2">>}] = + [#{packet_id := _PI2, qos := ?QOS_2, topic := <<"t/1">>, payload := <<"2">>}] = emqx_common_test_helpers:wait_publishes(1, 5_000), WaitGC(), #{subscriptions := Subs3, subscription_states := SStates3, streams := Streams3} = GetS(), @@ -507,7 +506,6 @@ t_subscription_state_change(Config) -> %% This testcase verifies the lifetimes of session's subscriptions to %% new stream events. t_new_stream_notifications(Config) -> - [Node1Spec | _] = ?config(node_specs, Config), [Node1] = ?config(nodes, Config), Port = get_mqtt_port(Node1, tcp), ClientId = mk_clientid(?FUNCTION_NAME, sub), @@ -1065,7 +1063,7 @@ check_stream_state_transitions(Trace) -> ). %% erlfmt-ignore -check_stream_state_transitions(StreamId, [], _) -> +check_stream_state_transitions(_StreamId, [], _) -> true; check_stream_state_transitions(StreamId = {ClientId, Key}, ['$restore', To | Rest], State) -> %% This clause verifies that restored session re-calculates states diff --git a/apps/emqx_bridge_kafka/test/emqx_bridge_kafka_impl_consumer_SUITE.erl b/apps/emqx_bridge_kafka/test/emqx_bridge_kafka_impl_consumer_SUITE.erl index 8557f8cc841..09fdc904bf3 100644 --- a/apps/emqx_bridge_kafka/test/emqx_bridge_kafka_impl_consumer_SUITE.erl +++ b/apps/emqx_bridge_kafka/test/emqx_bridge_kafka_impl_consumer_SUITE.erl @@ -1498,9 +1498,6 @@ t_failed_creation_then_fixed(Config) -> %% consume the messages produced during the down time. t_receive_after_recovery(Config) -> ct:timetrap(120_000), - ProxyPort = ?config(proxy_port, Config), - ProxyHost = ?config(proxy_host, Config), - ProxyName = ?config(proxy_name, Config), MQTTTopic = ?config(mqtt_topic, Config), NPartitions = ?config(num_partitions, Config), KafkaName = ?config(kafka_name, Config), diff --git a/apps/emqx_bridge_mongodb/test/emqx_bridge_v2_mongodb_SUITE.erl b/apps/emqx_bridge_mongodb/test/emqx_bridge_v2_mongodb_SUITE.erl index 95052907cee..13f506da63d 100644 --- a/apps/emqx_bridge_mongodb/test/emqx_bridge_v2_mongodb_SUITE.erl +++ b/apps/emqx_bridge_mongodb/test/emqx_bridge_v2_mongodb_SUITE.erl @@ -292,10 +292,6 @@ t_sync_query(Config) -> %% implementation returns a tuple with new state. %% See also: https://emqx.atlassian.net/browse/EMQX-13496. t_timeout_during_connector_health_check(Config0) -> - ProxyName = ?config(proxy_name, Config0), - ProxyHost = ?config(proxy_host, Config0), - ProxyPort = ?config(proxy_port, Config0), - ConnectorName = ?config(connector_name, Config0), Overrides = #{<<"resource_opts">> => #{<<"health_check_interval">> => <<"700ms">>}}, Config = emqx_bridge_v2_testlib:proplist_update( Config0, @@ -308,10 +304,6 @@ t_timeout_during_connector_health_check(Config0) -> begin {201, _} = create_bridge_api(Config, Overrides), - %% emqx_common_test_helpers:with_failure(timeout, ProxyName, ProxyHost, ProxyPort, fun() -> - %% ?retry(500, 10, ?assertEqual(<<"disconnected">>, GetConnectorStatus())), - %% ok - %% end), %% Wait until it's disconnected emqx_common_test_helpers:with_mock( emqx_resource_pool, diff --git a/apps/emqx_bridge_mysql/test/emqx_bridge_v2_mysql_SUITE.erl b/apps/emqx_bridge_mysql/test/emqx_bridge_v2_mysql_SUITE.erl index b337bf1940f..95ffe2590ff 100644 --- a/apps/emqx_bridge_mysql/test/emqx_bridge_v2_mysql_SUITE.erl +++ b/apps/emqx_bridge_mysql/test/emqx_bridge_v2_mysql_SUITE.erl @@ -307,7 +307,6 @@ t_timeout_disconnected_then_recover(Config) -> ProxyName = ?config(proxy_name, Config), ProxyHost = ?config(proxy_host, Config), ProxyPort = ?config(proxy_port, Config), - ConnectorName = ?config(connector_name, Config), ?check_trace( emqx_bridge_v2_testlib:snk_timetrap(), begin diff --git a/apps/emqx_cluster_link/test/emqx_cluster_link_schema_tests.erl b/apps/emqx_cluster_link/test/emqx_cluster_link_schema_tests.erl index af7561c10a1..66926f5d44f 100644 --- a/apps/emqx_cluster_link/test/emqx_cluster_link_schema_tests.erl +++ b/apps/emqx_cluster_link/test/emqx_cluster_link_schema_tests.erl @@ -23,9 +23,6 @@ parse_and_check(InnerConfigs) -> ), Checked. -link(Name) -> - link(Name, _Overrides = #{}). - link(Name, Overrides) -> Default = #{ <<"name">> => Name, diff --git a/apps/emqx_ds_backends/test/emqx_ds_backends_SUITE.erl b/apps/emqx_ds_backends/test/emqx_ds_backends_SUITE.erl index b9e2cfa517f..e8e117edb1b 100644 --- a/apps/emqx_ds_backends/test/emqx_ds_backends_SUITE.erl +++ b/apps/emqx_ds_backends/test/emqx_ds_backends_SUITE.erl @@ -69,7 +69,7 @@ t_02_smoke_iterate(Config) -> timer:sleep(1000), [{_, Stream}] = emqx_ds:get_streams(DB, TopicFilter, StartTime), {ok, Iter0} = emqx_ds:make_iterator(DB, Stream, TopicFilter, StartTime), - {ok, Iter, Batch} = emqx_ds_test_helpers:consume_iter(DB, Iter0), + {ok, _Iter, Batch} = emqx_ds_test_helpers:consume_iter(DB, Iter0), emqx_ds_test_helpers:diff_messages(Msgs, Batch). %% A simple smoke test that verifies that poll request is fulfilled @@ -181,7 +181,7 @@ t_05_restart(Config) -> {ok, _} = application:ensure_all_started(emqx_durable_storage), ok = emqx_ds_open_db(DB, opts(Config)), %% The old iterator should be still operational: - {ok, Iter, Batch} = emqx_ds_test_helpers:consume_iter(DB, Iter0), + {ok, _Iter, Batch} = emqx_ds_test_helpers:consume_iter(DB, Iter0), emqx_ds_test_helpers:diff_messages(Msgs, Batch). t_06_smoke_add_generation(Config) -> @@ -540,7 +540,7 @@ t_drop_generation_with_never_used_iterator(Config) -> ?assertNotEqual(Stream0, Stream1), {ok, Iter1} = emqx_ds:make_iterator(DB, Stream1, TopicFilter, StartTime), - {ok, Iter, Batch} = emqx_ds_test_helpers:consume_iter(DB, Iter1, #{batch_size => 1}), + {ok, _Iter, Batch} = emqx_ds_test_helpers:consume_iter(DB, Iter1, #{batch_size => 1}), emqx_ds_test_helpers:diff_messages(Msgs1, Batch). t_drop_generation_with_used_once_iterator(Config) -> @@ -718,7 +718,7 @@ groups() -> TCs = emqx_common_test_helpers:all(?MODULE), [{Backend, TCs -- exclude(Backend)} || Backend <- backends()]. -init_per_group(emqx_fdb_ds, Config) -> +init_per_group(emqx_fdb_ds, _Config) -> {skip, fixme}; init_per_group(emqx_ds_builtin_raft, Config) -> %% Raft backend is an odd one, as its main module is named diff --git a/apps/emqx_durable_storage/src/emqx_ds_beamformer.erl b/apps/emqx_durable_storage/src/emqx_ds_beamformer.erl index b6edd67dce2..af05f10e250 100644 --- a/apps/emqx_durable_storage/src/emqx_ds_beamformer.erl +++ b/apps/emqx_durable_storage/src/emqx_ds_beamformer.erl @@ -857,7 +857,6 @@ pack_test_() -> ]. split_test_() -> - Always = fun(_It, _Msg) -> true end, M1 = {<<"1">>, #message{id = <<"1">>}}, M2 = {<<"2">>, #message{id = <<"2">>}}, M3 = {<<"3">>, #message{id = <<"3">>}}, diff --git a/apps/emqx_durable_storage/src/emqx_durable_storage.app.src b/apps/emqx_durable_storage/src/emqx_durable_storage.app.src index a489479891f..b4303231d49 100644 --- a/apps/emqx_durable_storage/src/emqx_durable_storage.app.src +++ b/apps/emqx_durable_storage/src/emqx_durable_storage.app.src @@ -2,7 +2,7 @@ {application, emqx_durable_storage, [ {description, "Message persistence and subscription replays for EMQX"}, % strict semver, bump manually! - {vsn, "0.4.2"}, + {vsn, "0.4.3"}, {modules, []}, {registered, []}, {applications, [kernel, stdlib, rocksdb, gproc, mria, emqx_utils, gen_rpc]}, diff --git a/apps/emqx_resource/test/emqx_connector_demo.erl b/apps/emqx_resource/test/emqx_connector_demo.erl index e94d9c4c218..beec41c39e6 100644 --- a/apps/emqx_resource/test/emqx_connector_demo.erl +++ b/apps/emqx_resource/test/emqx_connector_demo.erl @@ -308,7 +308,7 @@ batch_individual_reply({async, ReplyFunAndArgs}, InstId, Batch, State) -> on_get_status(_InstId, #{health_check_error := true}) -> ?tp(connector_demo_health_check_error, #{}), ?status_disconnected; -on_get_status(_InstId, State = #{health_check_error := {msg, Message}}) -> +on_get_status(_InstId, _State = #{health_check_error := {msg, Message}}) -> ?tp(connector_demo_health_check_error, #{}), {?status_disconnected, Message}; on_get_status(_InstId, #{pid := Pid, health_check_error := {delay, Delay}}) ->