From d8d3c2a36045bcbe2ae5fd8f08b30a5d103f7bac Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Thu, 17 Aug 2017 00:53:36 +0200 Subject: Work around unexpected common_test behaviour diameter_traffic_SUITE has four layers of nested groups, so when a testcase is run it should get Config from four init_per_group plus one init_per_testcase. This isn't what happens: Config is being accumulated from several init_per_group in some manner that isn't clear, and the skip in the parent commit somehow results in growing test_server_gl:init/1 processes that eventually consume all memory. Replacing rather than prepending to Config in init_per_group works around this, but the common_test behaviour seems wrong. --- lib/diameter/test/diameter_traffic_SUITE.erl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl index fde7e9b8c2..a2c0f7fae6 100644 --- a/lib/diameter/test/diameter_traffic_SUITE.erl +++ b/lib/diameter/test/diameter_traffic_SUITE.erl @@ -325,7 +325,7 @@ init_per_group(Name, Config) false -> start_services(Config), add_transports(Config), - [{sleep, Name == parallel} | Config] + replace({sleep, Name == parallel}, Config) end; init_per_group(sctp = Name, Config) -> @@ -352,7 +352,7 @@ init_per_group(Name, Config) -> server_decoding = D, server_sender = SS, server_throttle = ST}, - [{group, G}, {runlist, select()} | Config]; + replace([{group, G}, {runlist, select()}], Config); _ -> Config end. @@ -396,6 +396,15 @@ init_per_testcase(Name, Config) -> 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 -- cgit v1.2.3