diff options
author | roboo <robo.karasek@gmail.com> | 2016-07-17 23:12:15 +0200 |
---|---|---|
committer | roboo <robo.karasek@gmail.com> | 2016-07-17 23:12:15 +0200 |
commit | 41c8fba1bc527484809613b36eb0de23f323bb74 (patch) | |
tree | 07c729341f0cf173850799eaa5f5d0756bdfe155 | |
parent | fe8b7e8f1313f08d8aa41239f7836539a88e9c46 (diff) | |
download | luarocks-41c8fba1bc527484809613b36eb0de23f323bb74.tar.gz luarocks-41c8fba1bc527484809613b36eb0de23f323bb74.tar.bz2 luarocks-41c8fba1bc527484809613b36eb0de23f323bb74.zip |
Fix of mock server setup
-rw-r--r-- | spec/upload_spec.lua | 15 | ||||
-rw-r--r-- | test/test_environment.lua | 6 |
2 files changed, 5 insertions, 16 deletions
diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index ee397ed4..b239c2f1 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua | |||
@@ -20,18 +20,6 @@ local extra_rocks = { | |||
20 | "/wsapi-1.6.1-1.src.rock", | 20 | "/wsapi-1.6.1-1.src.rock", |
21 | "/wsapi-xavante-1.6.1-1.src.rock", | 21 | "/wsapi-xavante-1.6.1-1.src.rock", |
22 | "/xavante-2.4.0-1.src.rock" | 22 | "/xavante-2.4.0-1.src.rock" |
23 | -- "copas 2.0.1-1", | ||
24 | -- coxpcall 1.16.0-1 | ||
25 | -- dkjson 2.5-2 | ||
26 | -- luafilesystem 1.6.3-2 | ||
27 | -- luasec 0.6-1 | ||
28 | -- luasocket 3.0rc1-2 | ||
29 | -- restserver 0.1-1 | ||
30 | -- restserver-xavante 0.2-1 | ||
31 | -- rings 1.3.0-1 | ||
32 | -- wsapi 1.6.1-1 | ||
33 | -- wsapi-xavante 1.6.1-1 | ||
34 | -- xavante 2.4.0-1 | ||
35 | } | 23 | } |
36 | 24 | ||
37 | describe("LuaRocks upload tests #blackbox #b_upload", function() | 25 | describe("LuaRocks upload tests #blackbox #b_upload", function() |
@@ -65,7 +53,8 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() | |||
65 | describe("LuaRocks upload tests with Xavante server", function() | 53 | describe("LuaRocks upload tests with Xavante server", function() |
66 | before_each(function() | 54 | before_each(function() |
67 | assert.is_true(test_env.need_rock("restserver-xavante")) | 55 | assert.is_true(test_env.need_rock("restserver-xavante")) |
68 | os.execute(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &") | 56 | local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &", true, test_env.env_variables) |
57 | os.execute(final_command) | ||
69 | end) | 58 | end) |
70 | 59 | ||
71 | after_each(function() | 60 | after_each(function() |
diff --git a/test/test_environment.lua b/test/test_environment.lua index eb545a47..dcad92cf 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua | |||
@@ -41,7 +41,7 @@ end | |||
41 | -- @param print_command boolean: print command if 'true' | 41 | -- @param print_command boolean: print command if 'true' |
42 | -- @param env_variables table: table of environment variables to export {FOO="bar", BAR="foo"} | 42 | -- @param env_variables table: table of environment variables to export {FOO="bar", BAR="foo"} |
43 | -- @return final_command string: concatenated command to execution | 43 | -- @return final_command string: concatenated command to execution |
44 | local function execute_helper(command, print_command, env_variables) | 44 | function test_env.execute_helper(command, print_command, env_variables) |
45 | local final_command = "" | 45 | local final_command = "" |
46 | 46 | ||
47 | if print_command then | 47 | if print_command then |
@@ -66,7 +66,7 @@ end | |||
66 | -- In Lua5.1 os.execute returns numeric value, but in Lua5.2+ returns boolean | 66 | -- In Lua5.1 os.execute returns numeric value, but in Lua5.2+ returns boolean |
67 | -- @return true/false boolean: status of the command execution | 67 | -- @return true/false boolean: status of the command execution |
68 | local function execute_bool(command, print_command, env_variables) | 68 | local function execute_bool(command, print_command, env_variables) |
69 | command = execute_helper(command, print_command, env_variables) | 69 | command = test_env.execute_helper(command, print_command, env_variables) |
70 | 70 | ||
71 | local ok = os.execute(command) | 71 | local ok = os.execute(command) |
72 | return ok == true or ok == 0 | 72 | return ok == true or ok == 0 |
@@ -75,7 +75,7 @@ end | |||
75 | --- Execute command and returns output of command | 75 | --- Execute command and returns output of command |
76 | -- @return output string: output the command execution | 76 | -- @return output string: output the command execution |
77 | local function execute_output(command, print_command, env_variables) | 77 | local function execute_output(command, print_command, env_variables) |
78 | command = execute_helper(command, print_command, env_variables) | 78 | command = test_env.execute_helper(command, print_command, env_variables) |
79 | 79 | ||
80 | local file = assert(io.popen(command)) | 80 | local file = assert(io.popen(command)) |
81 | local output = file:read('*all') | 81 | local output = file:read('*all') |