rabbit_ct_broker_helpers: Execute `make test-dist` once only

We use the `$SKIP_MAKE_TEST_DIST` environment variable to record the
fact that the command was already executed. We use an environment
variable and not a configuration parameter because it spans multiple
testsuites out-of-the-box.

Because `make test-dist` was executed each time a broker/cluster was
started, this change should save quite some time in testsuites which
start many brokers/clusters.

The caller can use the same variable to disable `make test-dist`
entirely.

[#141300123]
This commit is contained in:
Jean-Sébastien Pédron 2017-03-30 10:57:44 +02:00
parent 1faa985710
commit cc3599a0a4
1 changed files with 18 additions and 4 deletions

View File

@ -150,10 +150,24 @@ teardown_steps() ->
].
run_make_dist(Config) ->
SrcDir = ?config(current_srcdir, Config),
case rabbit_ct_helpers:make(Config, SrcDir, ["test-dist"]) of
{ok, _} -> Config;
_ -> {skip, "Failed to run \"make test-dist\""}
case os:getenv("SKIP_MAKE_TEST_DIST") of
false ->
SrcDir = ?config(current_srcdir, Config),
case rabbit_ct_helpers:make(Config, SrcDir, ["test-dist"]) of
{ok, _} ->
%% The caller can set $SKIP_MAKE_TEST_DIST to
%% manually skip this step which can be time
%% consuming. But we also use this variable to
%% record the fact we went through it already so we
%% save redundant calls.
os:putenv("SKIP_MAKE_TEST_DIST", "true"),
Config;
_ ->
{skip, "Failed to run \"make test-dist\""}
end;
_ ->
ct:pal(?LOW_IMPORTANCE, "(skip `$MAKE test-dist`)", []),
Config
end.
start_rabbitmq_nodes(Config) ->