aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2017-10-08 01:57:17 -0300
committerHisham Muhammad <hisham@gobolinux.org>2017-10-08 01:57:17 -0300
commitc5bcb900a8245845dd5cd4fd8bf796591769bbee (patch)
tree5698699bfa3a2ae778324852249d0eeca8719d3e /test
parentfeedb79595885c8f86ad412ef561f05664da7c14 (diff)
downloadluarocks-c5bcb900a8245845dd5cd4fd8bf796591769bbee.tar.gz
luarocks-c5bcb900a8245845dd5cd4fd8bf796591769bbee.tar.bz2
luarocks-c5bcb900a8245845dd5cd4fd8bf796591769bbee.zip
Tests: use local fixture for new_version test.
Diffstat (limited to 'test')
-rw-r--r--test/test_mock_server.lua43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/test_mock_server.lua b/test/test_mock_server.lua
new file mode 100644
index 00000000..74a57b89
--- /dev/null
+++ b/test/test_mock_server.lua
@@ -0,0 +1,43 @@
1--- Utility module to launch the mock-server from within test spec files.
2local test_mock_server = {}
3
4local assert = require("luassert")
5local test_env = require("test/test_environment")
6local testing_paths = test_env.testing_paths
7
8function test_mock_server.extra_rocks(more)
9 local rocks = {
10 -- rocks needed for mock-server
11 "/copas-2.0.1-1.src.rock",
12 "/coxpcall-1.16.0-1.src.rock",
13 "/dkjson-2.5-2.src.rock",
14 "/luafilesystem-1.6.3-1.src.rock",
15 "/luasec-0.6-1.rockspec",
16 "/luasocket-3.0rc1-2.src.rock",
17 "/luasocket-3.0rc1-2.rockspec",
18 "/restserver-0.1-1.src.rock",
19 "/restserver-xavante-0.2-1.src.rock",
20 "/rings-1.3.0-1.src.rock",
21 "/wsapi-1.6.1-1.src.rock",
22 "/wsapi-xavante-1.6.1-1.src.rock",
23 "/xavante-2.4.0-1.src.rock"
24 }
25 if more then
26 for _, rock in ipairs(more) do
27 table.insert(rocks, rock)
28 end
29 end
30 return rocks
31end
32
33function test_mock_server.init()
34 assert.is_true(test_env.need_rock("restserver-xavante"))
35 local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &", true, test_env.env_variables)
36 os.execute(final_command)
37end
38
39function test_mock_server.done()
40 os.execute("curl localhost:8080/shutdown")
41end
42
43return test_mock_server