From 310b7047a2dba4d4ed6ef8ef52a96456073e0c16 Mon Sep 17 00:00:00 2001 From: Alexander Petrovsky Date: Sun, 11 Feb 2018 22:56:39 +0300 Subject: Add extra args from vm.args into escripts and erl --- test/rlx_extended_bin_SUITE.erl | 44 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/rlx_extended_bin_SUITE.erl b/test/rlx_extended_bin_SUITE.erl index d2bf753..1177ede 100644 --- a/test/rlx_extended_bin_SUITE.erl +++ b/test/rlx_extended_bin_SUITE.erl @@ -24,6 +24,7 @@ all/0, start_sname_in_other_argsfile/1, start_preserves_arguments/1, + start_nodetool_with_data_from_argsfile/1, start_fail_when_no_name/1, start_fail_when_multiple_names/1, start_fail_when_missing_argsfile/1, @@ -78,7 +79,7 @@ init_per_testcase(_, Config) -> {state, State1} | Config]. all() -> - [start_sname_in_other_argsfile, start_preserves_arguments, + [start_sname_in_other_argsfile, start_preserves_arguments, start_nodetool_with_data_from_argsfile, start_fail_when_no_name, start_fail_when_multiple_names, start_fail_when_missing_argsfile, start_fail_when_nonreadable_argsfile, start_fail_when_relative_argsfile, start_fail_when_circular_argsfiles, @@ -94,7 +95,6 @@ all() -> ping(Config) -> LibDir1 = proplists:get_value(lib1, Config), - rlx_test_utils:create_app(LibDir1, "goal_app", "0.0.1", [stdlib,kernel], []), ConfigFile = filename:join([LibDir1, "relx.config"]), @@ -1490,6 +1490,46 @@ start_preserves_arguments(Config) -> %% a ping should fail after stopping a node {error, 1, _} = sh(filename:join([OutputDir, "foo", "bin", "foo ping"])). +start_nodetool_with_data_from_argsfile(Config) -> + LibDir1 = proplists:get_value(lib1, Config), + + rlx_test_utils:create_app(LibDir1, "goal_app", "0.0.1", [stdlib,kernel], []), + + ConfigFile = filename:join([LibDir1, "relx.config"]), + VmArgs = filename:join([LibDir1, "vm.args"]), + + rlx_test_utils:write_config(ConfigFile, + [{release, {foo, "0.0.1"}, + [goal_app]}, + {lib_dirs, [filename:join(LibDir1, "*")]}, + {vm_args, VmArgs}, + {generate_start_script, true}, + {extended_start_script, true} + ]), + + ec_file:write(VmArgs, "-setcookie cookie\n" + "-sname foo\n\n" + "-proto_dist inet_tcp\n\n"), + + OutputDir = filename:join([proplists:get_value(priv_dir, Config), + rlx_test_utils:create_random_name("relx-output")]), + + {ok, _State} = relx:do([{relname, foo}, + {relvsn, "0.0.1"}, + {goals, []}, + {lib_dirs, [LibDir1]}, + {log_level, 3}, + {output_dir, OutputDir}, + {config, ConfigFile}], ["release"]), + + %% now start/stop the release to make sure the extended script is working + {ok, _} = sh(filename:join([OutputDir, "foo", "bin", "foo start"])), + timer:sleep(2000), + {ok, "pong"} = sh(filename:join([OutputDir, "foo", "bin", "foo ping"])), + {ok, _} = sh(filename:join([OutputDir, "foo", "bin", "foo stop"])), + %% a ping should fail after stopping a node + {error, 1, _} = sh(filename:join([OutputDir, "foo", "bin", "foo ping"])). + start_fail_when_no_name(Config) -> LibDir1 = proplists:get_value(lib1, Config), VmArgs = filename:join([LibDir1, "vm.args"]), -- cgit v1.2.3