From 41c8fba1bc527484809613b36eb0de23f323bb74 Mon Sep 17 00:00:00 2001 From: roboo Date: Sun, 17 Jul 2016 23:12:15 +0200 Subject: Fix of mock server setup --- spec/upload_spec.lua | 15 ++------------- 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 = { "/wsapi-1.6.1-1.src.rock", "/wsapi-xavante-1.6.1-1.src.rock", "/xavante-2.4.0-1.src.rock" --- "copas 2.0.1-1", --- coxpcall 1.16.0-1 --- dkjson 2.5-2 --- luafilesystem 1.6.3-2 --- luasec 0.6-1 --- luasocket 3.0rc1-2 --- restserver 0.1-1 --- restserver-xavante 0.2-1 --- rings 1.3.0-1 --- wsapi 1.6.1-1 --- wsapi-xavante 1.6.1-1 --- xavante 2.4.0-1 } describe("LuaRocks upload tests #blackbox #b_upload", function() @@ -65,7 +53,8 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() describe("LuaRocks upload tests with Xavante server", function() before_each(function() assert.is_true(test_env.need_rock("restserver-xavante")) - os.execute(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &") + local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &", true, test_env.env_variables) + os.execute(final_command) end) 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 -- @param print_command boolean: print command if 'true' -- @param env_variables table: table of environment variables to export {FOO="bar", BAR="foo"} -- @return final_command string: concatenated command to execution -local function execute_helper(command, print_command, env_variables) +function test_env.execute_helper(command, print_command, env_variables) local final_command = "" if print_command then @@ -66,7 +66,7 @@ end -- In Lua5.1 os.execute returns numeric value, but in Lua5.2+ returns boolean -- @return true/false boolean: status of the command execution local function execute_bool(command, print_command, env_variables) - command = execute_helper(command, print_command, env_variables) + command = test_env.execute_helper(command, print_command, env_variables) local ok = os.execute(command) return ok == true or ok == 0 @@ -75,7 +75,7 @@ end --- Execute command and returns output of command -- @return output string: output the command execution local function execute_output(command, print_command, env_variables) - command = execute_helper(command, print_command, env_variables) + command = test_env.execute_helper(command, print_command, env_variables) local file = assert(io.popen(command)) local output = file:read('*all') -- cgit v1.2.3-55-g6feb