aboutsummaryrefslogtreecommitdiffstats
path: root/test/rlx_extended_bin_SUITE.erl
diff options
context:
space:
mode:
authorLuis Rascao <[email protected]>2016-12-18 18:15:24 +0000
committerLuis Rascao <[email protected]>2016-12-18 21:14:56 +0000
commit261b5ae9d46ae4dd001cbaa9cf911cd1abe30673 (patch)
treefb9a7ec7d8fbb17e21283a840ae5dfec227923c6 /test/rlx_extended_bin_SUITE.erl
parentbec4f5c38fe7e094f6d7e3a820fb635b7d65a949 (diff)
downloadrelx-261b5ae9d46ae4dd001cbaa9cf911cd1abe30673.tar.gz
relx-261b5ae9d46ae4dd001cbaa9cf911cd1abe30673.tar.bz2
relx-261b5ae9d46ae4dd001cbaa9cf911cd1abe30673.zip
Obtain release node name from Erlang VM instead of OS
Diffstat (limited to 'test/rlx_extended_bin_SUITE.erl')
-rw-r--r--test/rlx_extended_bin_SUITE.erl45
1 files changed, 42 insertions, 3 deletions
diff --git a/test/rlx_extended_bin_SUITE.erl b/test/rlx_extended_bin_SUITE.erl
index 99a45fb..ee77d14 100644
--- a/test/rlx_extended_bin_SUITE.erl
+++ b/test/rlx_extended_bin_SUITE.erl
@@ -23,6 +23,7 @@
init_per_testcase/2,
all/0,
ping/1,
+ shortname_ping/1,
attach/1,
pid/1,
restart/1,
@@ -62,9 +63,8 @@ init_per_testcase(_, Config) ->
{state, State1} | Config].
all() ->
- [ping, attach, pid, restart, reboot, escript,
- remote_console, replace_os_vars,
- replace_os_vars_dev_mode, replace_os_vars_twice,
+ [ping, shortname_ping, attach, pid, restart, reboot, escript,
+ remote_console, replace_os_vars, replace_os_vars_dev_mode, replace_os_vars_twice,
custom_start_script_hooks, builtin_wait_for_vm_start_script_hook,
builtin_pid_start_script_hook, builtin_wait_for_process_start_script_hook,
mixed_custom_and_builtin_start_script_hooks].
@@ -102,6 +102,45 @@ ping(Config) ->
%% a ping should fail after stopping a node
{error, 1, _} = sh(filename:join([OutputDir, "foo", "bin", "foo ping"])).
+shortname_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"]),
+ 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, "-sname foo\n\n"
+ "-setcookie cookie\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"])).
+
attach(Config) ->
LibDir1 = proplists:get_value(lib1, Config),