Skip to content

Commit

Permalink
Update code after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
aleklisi committed Oct 23, 2023
1 parent b731721 commit 9a32d45
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 37 deletions.
14 changes: 4 additions & 10 deletions test/amoc_users_monitor_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").

-include("scenario_template_2.hrl").

-define(SCENARIO, my_test_scenario).

-compile(export_all).

all() ->
Expand All @@ -31,15 +27,13 @@ init_per_testcase(amoc_users_monitor_keeps_track_of_users, Config) ->
common_init_per_testcase(Config).

common_init_per_testcase(Config) ->
amoc_api_helper:start_amoc(),
ok = amoc_scenario:install_module(?SCENARIO, ?DUMMY_SCENARIO_MODULE(?SCENARIO)),
application:ensure_all_started(amoc),
meck:new(amoc_dist, []),
Config.

end_per_testcase(_TC, _Config) ->
meck:unload(amoc_dist),
amoc_api_helper:remove_module(?SCENARIO),
amoc_api_helper:stop_amoc().
application:stop(amoc).

%% Test cases

Expand All @@ -49,7 +43,7 @@ error_when_amoc_users_monitor_is_disabled(_Config) ->

amoc_users_monitor_keeps_track_of_users(_Config) ->
?assertEqual(enabled, amoc_users_monitor:is_users_monitor_enabled()),
ok = amoc:do(?SCENARIO, 10, []),
ok = amoc:do(dummy_scenario_test, 10, []),

timer:sleep(1_000),

Expand All @@ -60,4 +54,4 @@ amoc_users_monitor_keeps_track_of_users(_Config) ->
?assertEqual(6, sets:size(MonitoredUsers)),
?assertEqual(2, length(DiedNormally)),
?assertEqual(2, length(DiedUnnormally)),
?assertMatch([{_, {exit, test_crush_reason, _}} | _], DiedUnnormally).
?assertMatch([{_, test_crush_reason} | _], DiedUnnormally).
7 changes: 2 additions & 5 deletions test/scenario_template_2.hrl → test/dummy_scenario_test.erl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-define(DUMMY_SCENARIO_MODULE(Name), <<"
-module(",(atom_to_binary(Name,utf8))/binary,").
-module(dummy_scenario_test).

-behaviour(amoc_scenario).

-export([start/1]).
Expand All @@ -9,7 +9,6 @@
init() ->
ok.

% -spec start(amoc_scenario:user_id()) -> any().
start(Id) when Id == 2 ->
1 = 2;
start(Id) when Id == 3 ->
Expand All @@ -19,5 +18,3 @@ start(Id) when Id == 5; Id == 6 ->
start(_Id) ->
timer:sleep(timer:minutes(1)),
amoc_user:stop().
">>).
22 changes: 0 additions & 22 deletions test/scenario_template.hrl

This file was deleted.

0 comments on commit 9a32d45

Please sign in to comment.