66-compile ([export_all , nowarn_export_all ]).
77
88-define (DEFAULT_INTERVAL , 60000 ). % % one minute
9- -define (RECV (Msg , Timeout ), receive Msg -> ok after Timeout -> {error , not_received_yet } end ).
9+ -define (RECV (Msg , Timeout ), receive Msg -> ok after ( Timeout + 50 ) -> {error , not_received_yet } end ).
1010
1111all () ->
1212 [
13- {group , api },
14- {group , properties }
13+ {group , properties },
14+ {group , api }
1515 ].
1616
1717groups () ->
1818 [
19- {api , [parallel ],
20- [
21- start ,
22- start_descriptive ,
23- start_interarrival ,
24- start_interarrival_zero ,
25- start_interarrival_infinity ,
26- start_rate_zero ,
27- start_rate_infinity ,
28- start_interval_zero ,
29- low_rate_does_not_get_remapped ,
30- low_interval_does_not_get_remapped ,
31- start_and_stop ,
32- change_rate ,
33- interval_equal_zero_limits_parallelism ,
34- change_rate_to_interval_zero_limits_parallelism ,
35- change_rate_triggers_parallelism ,
36- change_rate_gradually ,
37- change_interarrival_gradually ,
38- change_rate_gradually_verify_descriptions ,
39- just_wait ,
40- wait_for_process_to_die_sends_a_kill ,
41- async_runner_dies_while_waiting_raises_exit ,
42- async_runner_dies_when_throttler_dies ,
43- pause_and_resume ,
44- get_state
45- ]},
46- {properties , [],
47- [
48- change_rate_gradually_verify_descriptions_properties ,
49- % Note that the smallest delay possible for a process is 1ms (receive operations),
50- % hence if we give for example 10 workers 1ms delays, we get 600_000 ticks per minute.
51- % and if we give for example 48 workers 1ms delays, we get 2_880_000 ticks per minute.
52- % That means, that is realistically the maximum rate we could possibly manage
53- % with a static pool of such number of workers.
54- pool_config_is_precise_for_rates_1 ,
55- pool_config_is_precise_for_rates_2 ,
56- pool_config_is_precise_for_rates_3 ,
57- pool_config_is_precise_for_rates_4 ,
58- pool_config_is_precise_for_rates_5 ,
59- pool_config_is_precise_for_rates_6 ,
60- pool_config_is_precise_for_rates_7 ,
61- pool_config_is_precise_for_rates_8 ,
62- pool_config_is_precise_for_rates_9 ,
63- pool_config_is_precise_for_rates_10
64- ]}
19+ {api , [parallel , {repeat , 3 }], api_testcases ()},
20+ {properties , [{repeat , 3 }], properties_testcases ()}
21+ ].
22+
23+ api_testcases () ->
24+ [
25+ start ,
26+ start_descriptive ,
27+ start_interarrival ,
28+ start_interarrival_zero ,
29+ start_interarrival_infinity ,
30+ start_rate_zero ,
31+ start_rate_infinity ,
32+ start_interval_zero ,
33+ low_rate_does_not_get_remapped ,
34+ low_interval_does_not_get_remapped ,
35+ start_and_stop ,
36+ change_rate ,
37+ interval_equal_zero_limits_parallelism ,
38+ change_rate_to_interval_zero_limits_parallelism ,
39+ change_rate_triggers_parallelism ,
40+ change_rate_gradually ,
41+ change_interarrival_gradually ,
42+ change_rate_gradually_verify_descriptions ,
43+ just_wait ,
44+ wait_for_process_to_die_sends_a_kill ,
45+ async_runner_dies_while_waiting_raises_exit ,
46+ async_runner_dies_when_throttler_dies ,
47+ pause_and_resume ,
48+ get_state
49+ ].
50+
51+ properties_testcases () ->
52+ [
53+ change_rate_gradually_verify_descriptions_properties ,
54+ % Note that the smallest delay possible for a process is 1ms (receive operations),
55+ % hence if we give for example 10 workers 1ms delays, we get 600_000 ticks per minute.
56+ % and if we give for example 48 workers 1ms delays, we get 2_880_000 ticks per minute.
57+ % That means, that is realistically the maximum rate we could possibly manage
58+ % with a static pool of such number of workers.
59+ pool_config_is_precise_for_rates_1 ,
60+ pool_config_is_precise_for_rates_2 ,
61+ pool_config_is_precise_for_rates_3 ,
62+ pool_config_is_precise_for_rates_4 ,
63+ pool_config_is_precise_for_rates_5 ,
64+ pool_config_is_precise_for_rates_6 ,
65+ pool_config_is_precise_for_rates_7 ,
66+ pool_config_is_precise_for_rates_8 ,
67+ pool_config_is_precise_for_rates_9 ,
68+ pool_config_is_precise_for_rates_10
6569 ].
6670
6771init_per_suite (Config ) ->
72+ meck :new (amoc_throttle_config , [passthrough , non_strict , no_link ]),
6873 application :ensure_all_started (amoc ),
6974 amoc_cluster :set_master_node (node ()),
7075 TelemetryEvents = [[amoc , throttle , Event ] || Event <- [init , rate , request , execute , process ]],
@@ -74,18 +79,19 @@ init_per_suite(Config) ->
7479end_per_suite (_ ) ->
7580 application :stop (amoc ),
7681 telemetry_helpers :stop (),
82+ meck :unload (),
7783 ok .
7884
7985init_per_group (properties , Config ) ->
80- meck :new (amoc_throttle_config , [passthrough , non_strict , no_link ]),
81- meck :expect (amoc_throttle_config , no_of_processes , [], 100 ),
86+ ok = meck :expect (amoc_throttle_config , no_of_processes , [], 100 ),
8287 Config ;
8388init_per_group (_ , Config ) ->
8489 Config .
8590
8691end_per_group (properties , _Config ) ->
87- meck :unload (amoc_throttle_config );
92+ ok = meck :delete (amoc_throttle_config , no_of_processes , 0 );
8893end_per_group (_ , _Config ) ->
94+ [amoc_throttle :stop (TC ) || TC <- api_testcases () -- [async_runner_dies_when_throttler_dies ]],
8995 ok .
9096
9197init_per_testcase (_ , Config ) ->
0 commit comments