aboutsummaryrefslogtreecommitdiff
path: root/test/test_environment.lua
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2017-10-08 14:57:41 -0400
committerHisham Muhammad <hisham@gobolinux.org>2017-10-08 14:57:41 -0400
commit5aa06d43a86754f30347813803f2a9eb6f99a611 (patch)
treeb4a0efac8c80caf273dc41764b139cfa3ea9af39 /test/test_environment.lua
parentfa91718c540542d94e8bf7df94e9fdf0cd170569 (diff)
downloadluarocks-5aa06d43a86754f30347813803f2a9eb6f99a611.tar.gz
luarocks-5aa06d43a86754f30347813803f2a9eb6f99a611.tar.bz2
luarocks-5aa06d43a86754f30347813803f2a9eb6f99a611.zip
Tests: move mock-server utils into test_environment.lua
This avoids trouble with changing package.paths during tests.
Diffstat (limited to 'test/test_environment.lua')
-rw-r--r--test/test_environment.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/test_environment.lua b/test/test_environment.lua
index 56b394cd..a663c1c3 100644
--- a/test/test_environment.lua
+++ b/test/test_environment.lua
@@ -685,6 +685,43 @@ local function install_luarocks(install_env_vars)
685 print("LuaRocks installed correctly!") 685 print("LuaRocks installed correctly!")
686end 686end
687 687
688function test_env.mock_server_extra_rocks(more)
689 local rocks = {
690 -- rocks needed for mock-server
691 "/copas-2.0.1-1.src.rock",
692 "/coxpcall-1.16.0-1.src.rock",
693 "/dkjson-2.5-2.src.rock",
694 "/luafilesystem-1.6.3-1.src.rock",
695 "/luasec-0.6-1.rockspec",
696 "/luasocket-3.0rc1-2.src.rock",
697 "/luasocket-3.0rc1-2.rockspec",
698 "/restserver-0.1-1.src.rock",
699 "/restserver-xavante-0.2-1.src.rock",
700 "/rings-1.3.0-1.src.rock",
701 "/wsapi-1.6.1-1.src.rock",
702 "/wsapi-xavante-1.6.1-1.src.rock",
703 "/xavante-2.4.0-1.src.rock"
704 }
705 if more then
706 for _, rock in ipairs(more) do
707 table.insert(rocks, rock)
708 end
709 end
710 return rocks
711end
712
713function test_env.mock_server_init()
714 local assert = require("luassert")
715 local testing_paths = test_env.testing_paths
716 assert.is_true(test_env.need_rock("restserver-xavante"))
717 local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &", true, test_env.env_variables)
718 os.execute(final_command)
719end
720
721function test_env.mock_server_done()
722 os.execute("curl localhost:8080/shutdown")
723end
724
688--- 725---
689-- Main function to create config files and testing environment 726-- Main function to create config files and testing environment
690function test_env.main() 727function test_env.main()