summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorUlf Wiger <ulf@wiger.net>2015-07-03 19:50:41 +0200
committerUlf Wiger <ulf@wiger.net>2015-07-03 19:50:41 +0200
commit2b6beaeedad7be6d1047efa2293ef7941f7752d0 (patch)
tree45879a772d92e3bf7361e643bf68bc6def43c354 /test
parent2351d9db1eb0216bbc169a632e7686da6e1964ae (diff)
downloadrvi_core-2b6beaeedad7be6d1047efa2293ef7941f7752d0.tar.gz
first stab at test suite
Diffstat (limited to 'test')
-rw-r--r--test/rvi_core_SUITE.erl79
1 files changed, 79 insertions, 0 deletions
diff --git a/test/rvi_core_SUITE.erl b/test/rvi_core_SUITE.erl
new file mode 100644
index 0000000..3b1f666
--- /dev/null
+++ b/test/rvi_core_SUITE.erl
@@ -0,0 +1,79 @@
+-module(rvi_core_SUITE).
+
+%% common_test exports
+-export(
+ [
+ all/0, groups/0, suite/0,
+ init_per_suite/1, end_per_suite/1,
+ init_per_testcase/2, end_per_testcase/2
+ ]).
+
+%% test case exports
+-export(
+ [
+ test_install_backend_node/1
+ ]).
+
+-include_lib("common_test/include/ct.hrl").
+
+all() ->
+ [
+ {group, test_install}
+ ].
+
+groups() ->
+ [
+ {test_install, [shuffle],
+ [
+ test_install_backend_node
+ ]}
+ ].
+
+suite() ->
+ [].
+
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_testcase(_Case, Config) ->
+ Config.
+
+end_per_testcase(_Case, _Config) ->
+ ok.
+
+%% ======================================================================
+%% Test cases
+%% ======================================================================
+
+test_install_backend_node(Config) ->
+ ct:log("Current working dir: ~p", [file:get_cwd()]),
+ ct:log("Config = ~p", [Config]),
+ PrivDir = ?config(priv_dir, Config),
+ ct:log("PrivDir = ~p", [PrivDir]),
+ in_dir(PrivDir, fun(Cfg) -> install_backend_node_(Cfg) end, Config),
+ ok.
+
+install_backend_node_(_Config) ->
+ Root = code:lib_dir(rvi_core),
+ Scripts = filename:join(Root, "scripts"),
+ ct:log("Root = ~p", [Root]),
+ Cmd = lists:flatten(
+ ["RVI_LOGLEVEL=debug RVI_MYIP=127.0.0.1 ",
+ Scripts, "/setup_rvi_node.sh -d -n backend -c ",
+ Root, "/rvi_backend.config"]),
+ ct:log("Cmd = `~s`", [Cmd]),
+ Res = os:cmd(Cmd),
+ ct:log("install_backend_node/1 -> ~s", [Res]),
+ Res.
+
+in_dir(D, F, Cfg) ->
+ {ok, Cur} = file:get_cwd(),
+ try
+ ok = file:set_cwd(D),
+ F(Cfg)
+ after
+ file:set_cwd(Cur)
+ end.