Skip to content

Commit

Permalink
Fixing small tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Janusz Jakubiec authored and Janusz Jakubiec committed Apr 26, 2023
1 parent 72f1278 commit 6626e33
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion big_tests/tests/service_mongoose_system_metrics_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ module_opts_are_reported(_Config) ->
check_module_backend(mod_privacy, Backend),
check_module_backend(mod_private, Backend),
check_module_backend(mod_pubsub, Backend),
check_module_opt(<<"mod_push_service_mongoosepush">>, <<"api_version">>, <<"\"v3\"">>),
check_module_opt(<<"mod_push_service_mongoosepush">>, <<"api_version">>, <<"v3">>),
check_module_backend(mod_roster, Backend),
check_module_backend(mod_vcard, Backend).

Expand Down
6 changes: 3 additions & 3 deletions src/system_metrics/service_mongoose_system_metrics.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
-include("mongoose_config_spec.hrl").

-ifdef(PROD_NODE).
-define(TRACKING_ID, #{id => "UA-151671255-3",
-define(TRACKING_ID, #{id => "G-7KQE4W9SVJ",
secret => "8P4wQIkwSV6zay22uKsnLg"}).
-else.
-define(TRACKING_ID, #{id => "G-7KQE4W9SVJ",
secret => "8P4wQIkwSV6zay22uKsnLg"}).
-endif.
-define(TRACKING_ID_CI, #{id => "UA-151671255-1",
-define(TRACKING_ID_CI, #{id => "G-7KQE4W9SVJ",
secret => "8P4wQIkwSV6zay22uKsnLg"}).

-include("mongoose.hrl").
Expand Down Expand Up @@ -76,7 +76,7 @@ config_spec() ->
<<"tracking_id">> => tracking_id_section()
},
defaults = #{<<"initial_report">> => timer:minutes(5),
<<"periodic_report">> => timer:minutes(6)}
<<"periodic_report">> => timer:hours(3)}
}.

tracking_id_section() ->
Expand Down
5 changes: 4 additions & 1 deletion test/common/config_parser_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ options("miscellaneous") ->
#{service_mongoose_system_metrics => #{initial_report => 20000,
periodic_report => 300000,
report => true,
tracking_id => "UA-123456789"}}},
tracking_id => #{
id => "UA-12345678",
secret => "Secret"
}}}},
{{s2s, <<"anonymous.localhost">>}, default_s2s()},
{{s2s, <<"localhost">>}, default_s2s()},
{sm_backend, mnesia},
Expand Down
7 changes: 5 additions & 2 deletions test/config_parser_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2935,13 +2935,16 @@ service_mongoose_system_metrics(_Config) ->
?cfg(P, default_config(P), T(#{})),
?cfg(P ++ [initial_report], 5000, T(#{<<"initial_report">> => 5000})),
?cfg(P ++ [periodic_report], 5000, T(#{<<"periodic_report">> => 5000})),
?cfg(P ++ [tracking_id], "UA-123456789", T(#{<<"tracking_id">> => <<"UA-123456789">>})),
?cfg(P ++ [tracking_id], #{id => "UA-12345678", secret => "Secret"},
T(#{<<"tracking_id">> => #{<<"id">> => <<"UA-12345678">>, <<"secret">> => <<"Secret">>}})),
?cfg(P ++ [report], true, T(#{<<"report">> => true})),
?err(T(#{<<"initial_report">> => <<"forever">>})),
?err(T(#{<<"periodic_report">> => <<"forever">>})),
?err(T(#{<<"initial_report">> => -1})),
?err(T(#{<<"periodic_report">> => -1})),
?err(T(#{<<"tracking_id">> => 666})),
?err(T(#{<<"tracking_id">> => #{<<"id">> => 666}})),
?err(T(#{<<"tracking_id">> => #{<<"secret">> => 666}})),
?err(T(#{<<"tracking_id">> => #{<<"secret">> => 666, <<"id">> => 666}})),
?err(T(#{<<"report">> => <<"maybe">>})).

%% Helpers for module tests
Expand Down
3 changes: 2 additions & 1 deletion test/config_parser_SUITE_data/miscellaneous.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@
report = true
initial_report = 20_000
periodic_report = 300_000
tracking_id = "UA-123456789"
tracking_id.id = "UA-12345678"
tracking_id.secret = "Secret"

0 comments on commit 6626e33

Please sign in to comment.