diff options
author | Anders Svensson <[email protected]> | 2017-08-18 11:00:37 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2017-08-18 11:00:37 +0200 |
commit | f392006644991074d2c4d5055773409c5e0503d7 (patch) | |
tree | a066b805a6419f0cc3d0384437a9729a5fe1cf4a /lib/diameter/test/diameter_traffic_SUITE.erl | |
parent | 196bf1ada0be5f5f2927a2028ef38a7547ec3db6 (diff) | |
parent | d8d3c2a36045bcbe2ae5fd8f08b30a5d103f7bac (diff) | |
download | otp-f392006644991074d2c4d5055773409c5e0503d7.tar.gz otp-f392006644991074d2c4d5055773409c5e0503d7.tar.bz2 otp-f392006644991074d2c4d5055773409c5e0503d7.zip |
Merge branch 'anders/diameter/performance/OTP-14521' into maint
* anders/diameter/performance/OTP-14521:
Work around unexpected common_test behaviour
Randomly skip groups in traffic suite
Randomly disable traffic counters in traffic suite
Add service_opt() traffic_counters
Fix type spec
Split AVPs at decode
Avoid unnecessary copying of binaries in diameter_tcp
Don't update diameter_tcp state unnecessarily
Don't update diameter_tcp state unnecessarily
Simplify extraction of incoming Diameter messages in diameter_tcp
Restructure/simplify message reception in diameter_peer_fsm
Sleep randomly at the start of (parallel) traffic testcases
Fix ct return value in traffic suite
Fix type spec
Optimize sub-binaries
Optimize sub-binaries
Count AVPs in #diameter_avp.index
Don't extract options unnecessarily at encode
Redo message decode as a single pass
Diffstat (limited to 'lib/diameter/test/diameter_traffic_SUITE.erl')
-rw-r--r-- | lib/diameter/test/diameter_traffic_SUITE.erl | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl index f47b223509..8b0ce9710a 100644 --- a/lib/diameter/test/diameter_traffic_SUITE.erl +++ b/lib/diameter/test/diameter_traffic_SUITE.erl @@ -123,6 +123,9 @@ %% =========================================================================== +%% Fraction of shuffle/parallel groups to randomly skip. +-define(SKIP, 0.25). + %% Positive number of testcases from which to select (randomly) from %% tc(), the list of testcases to run, or [] to run all. The random %% selection is to limit the time it takes for the suite to run. @@ -327,8 +330,14 @@ init_per_group(_) -> init_per_group(Name, Config) when Name == shuffle; Name == parallel -> - start_services(Config), - add_transports(Config); + case rand:uniform() < ?SKIP of + true -> + {skip, random}; + false -> + start_services(Config), + add_transports(Config), + replace({sleep, Name == parallel}, Config) + end; init_per_group(sctp = Name, Config) -> {_, Sctp} = lists:keyfind(Name, 1, Config), @@ -354,7 +363,7 @@ init_per_group(Name, Config) -> server_decoding = D, server_sender = SS, server_throttle = ST}, - [{group, G}, {runlist, select(T)} | Config]; + replace([{group, G}, {runlist, select(T)}], Config); _ -> Config end. @@ -391,12 +400,23 @@ init_per_testcase(Name, Config) -> _ when not Run -> {skip, random}; _ -> + proplists:get_value(sleep, Config, false) + andalso timer:sleep(rand:uniform(200)), [{testcase, Name} | Config] end. end_per_testcase(_, _) -> ok. +%% replace/2 + +replace(Pairs, Config) + when is_list(Pairs) -> + lists:foldl(fun replace/2, Config, Pairs); + +replace({Key, _} = T, Config) -> + [T | lists:keydelete(Key, 1, Config)]. + %% -------------------- %% Testcases to run when services are started and connections @@ -469,12 +489,17 @@ start_services(Config) -> server_decoding = SD} = Grp = group(Config), - ok = diameter:start_service(SN, [{decode_format, SD} + ok = diameter:start_service(SN, [{traffic_counters, bool()}, + {decode_format, SD} | ?SERVICE(SN, Grp)]), - ok = diameter:start_service(CN, [{sequence, ?CLIENT_MASK}, + ok = diameter:start_service(CN, [{traffic_counters, bool()}, + {sequence, ?CLIENT_MASK}, {strict_arities, decode} | ?SERVICE(CN, Grp)]). +bool() -> + 0.5 =< rand:uniform(). + add_transports(Config) -> #group{transport = T, encoding = E, |