From fe8b7e8f1313f08d8aa41239f7836539a88e9c46 Mon Sep 17 00:00:00 2001 From: roboo Date: Sun, 17 Jul 2016 19:20:01 +0200 Subject: New upload tests with mock-server --- spec/upload_spec.lua | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index c10ef0e9..ee397ed4 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua @@ -1,10 +1,37 @@ local test_env = require("test/test_environment") local run = test_env.run +local testing_paths = test_env.testing_paths test_env.unload_luarocks() local extra_rocks = { - "/lua-cjson-2.1.0-1.src.rock" + "/lua-cjson-2.1.0-1.src.rock", + + "/copas-2.0.1-1.src.rock", + "/coxpcall-1.16.0-1.src.rock", + "/dkjson-2.5-2.src.rock", + "/luafilesystem-1.6.3-1.src.rock", + "/luasec-0.6-1.rockspec", + "/luasocket-3.0rc1-1.src.rock", + "/luasocket-3.0rc1-1.rockspec", + "/restserver-0.1-1.src.rock", + "/restserver-xavante-0.2-1.src.rock", + "/rings-1.3.0-1.src.rock", + "/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() @@ -34,6 +61,24 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force luacov-0.11.0-1.rockspec")) assert.is_true(run.luarocks_bool("install lua-cjson")) end) + + 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 &") + end) + + after_each(function() + os.execute("curl localhost:8080/shutdown") + end) + + it("LuaRocks upload rockspec with api-key", function() + assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-1.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) + end) + it("LuaRocks upload rockspec with api-key and skip-pack", function() + assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-1.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) + end) + end) end) -- cgit v1.2.3-55-g6feb 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(-) (limited to 'spec') 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 From b04588031609c8cbcf3636f0dadb9fc6cd960c8f Mon Sep 17 00:00:00 2001 From: roboo Date: Mon, 18 Jul 2016 17:14:14 +0200 Subject: Fix of upload tests for lua5.3 --- spec/upload_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec') diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index b239c2f1..d959f64a 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua @@ -12,8 +12,8 @@ local extra_rocks = { "/dkjson-2.5-2.src.rock", "/luafilesystem-1.6.3-1.src.rock", "/luasec-0.6-1.rockspec", - "/luasocket-3.0rc1-1.src.rock", - "/luasocket-3.0rc1-1.rockspec", + "/luasocket-3.0rc1-2.src.rock", + "/luasocket-3.0rc1-2.rockspec", "/restserver-0.1-1.src.rock", "/restserver-xavante-0.2-1.src.rock", "/rings-1.3.0-1.src.rock", -- cgit v1.2.3-55-g6feb From a90a2066b08b4cc047be84c673024f7f5e9fa054 Mon Sep 17 00:00:00 2001 From: roboo Date: Mon, 18 Jul 2016 17:35:40 +0200 Subject: Fix of upload tests for lua5.3 --- spec/install_spec.lua | 4 ++-- spec/make_spec.lua | 2 +- spec/pack_spec.lua | 2 +- spec/upload_spec.lua | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) (limited to 'spec') diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 0b2ffb53..28e349c3 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -83,14 +83,14 @@ describe("LuaRocks install tests #blackbox #b_install", function() end) it("LuaRocks install only-deps of luasocket packed rock", function() - assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket")) + assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket 3.0rc1-1")) local output = run.luarocks("install --only-deps " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock") assert.are.same(output, "Successfully installed dependencies for luasocket 3.0rc1-1") assert.is_true(os.remove("luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) end) it("LuaRocks install reinstall", function() - assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket")) + assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket 3.0rc1-1")) assert.is_true(run.luarocks_bool("install " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) assert.is_true(run.luarocks_bool("install --deps-mode=none " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) assert.is_true(os.remove("luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) diff --git a/spec/make_spec.lua b/spec/make_spec.lua index 2821c143..3e843f7b 100644 --- a/spec/make_spec.lua +++ b/spec/make_spec.lua @@ -27,7 +27,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() it("LuaRocks make with rockspec", function() -- make luasocket - assert.is_true(run.luarocks_bool("download --source luasocket")) + assert.is_true(run.luarocks_bool("download --source luasocket 3.0rc1-1")) assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-1.src.rock")) lfs.chdir("luasocket-3.0rc1-1/luasocket-3.0-rc1/") assert.is_true(run.luarocks_bool("make luasocket-3.0rc1-1.rockspec")) diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 67ed5f3f..78aab9aa 100644 --- a/spec/pack_spec.lua +++ b/spec/pack_spec.lua @@ -52,7 +52,7 @@ describe("LuaRocks pack tests #blackbox #b_pack", function() it("LuaRocks pack src", function() assert.is_true(run.luarocks_bool("install luasec")) - assert.is_true(run.luarocks_bool("download --rockspec luasocket")) + assert.is_true(run.luarocks_bool("download --rockspec luasocket 3.0rc1-1")) assert.is_true(run.luarocks_bool("pack luasocket-3.0rc1-1.rockspec")) assert.is_true(test_env.remove_files(lfs.currentdir(), "luasocket-")) end) diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index d959f64a..02b68611 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua @@ -7,6 +7,7 @@ test_env.unload_luarocks() local extra_rocks = { "/lua-cjson-2.1.0-1.src.rock", + -- rocks needed for mock-server "/copas-2.0.1-1.src.rock", "/coxpcall-1.16.0-1.src.rock", "/dkjson-2.5-2.src.rock", @@ -50,7 +51,7 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() assert.is_true(run.luarocks_bool("install lua-cjson")) end) - describe("LuaRocks upload tests with Xavante server", function() + describe("LuaRocks upload tests with Xavante server #mock", function() before_each(function() assert.is_true(test_env.need_rock("restserver-xavante")) local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &", true, test_env.env_variables) -- cgit v1.2.3-55-g6feb From 3945f90b0bd80024294b048a793bae526cad30e2 Mon Sep 17 00:00:00 2001 From: roboo Date: Tue, 19 Jul 2016 22:56:28 +0200 Subject: Test improvements --- spec/build_spec.lua | 36 +++++++++++++++++++----------------- spec/help_spec.lua | 6 +++--- spec/install_spec.lua | 12 ++++++------ spec/make_spec.lua | 10 +++++----- spec/pack_spec.lua | 6 ++---- spec/remove_spec.lua | 2 +- spec/search_spec.lua | 6 +----- spec/upload_spec.lua | 6 +++--- spec/util_spec.lua | 13 ++++++++----- spec/write_rockspec_spec.lua | 3 +-- 10 files changed, 49 insertions(+), 51 deletions(-) (limited to 'spec') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 682c6dcf..2ede5211 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -57,7 +57,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() end) it("LuaRocks build lpeg verbose", function() - assert.is_true(run.luarocks_bool("build --verbose lpeg")) + assert.is.truthy(run.luarocks("build --verbose lpeg")) end) it("LuaRocks build lpeg branch=master", function() @@ -82,9 +82,8 @@ describe("LuaRocks build tests #blackbox #b_build", function() end) describe("LuaRocks build - basic builds", function() - it("LuaRocks build luadoc", function() - assert.is_true(run.luarocks_bool("build luadoc")) + assert.is_true(run.luarocks_bool(test_env.quiet("build luadoc"))) end) it("LuaRocks build luacov diff version", function() @@ -103,12 +102,12 @@ describe("LuaRocks build tests #blackbox #b_build", function() end) it("LuaRocks build supported platforms lpty", function() - assert.is_true(run.luarocks_bool("build lpty")) + assert.is_true(run.luarocks_bool(test_env.quiet("build lpty"))) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpty")) end) it("LuaRocks build luasec with skipping dependency checks", function() - assert.is_true(run.luarocks_bool("build luasec --nodeps")) + assert.is_true(run.luarocks_bool(test_env.quiet("build luasec --nodeps"))) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec")) end) @@ -119,31 +118,34 @@ describe("LuaRocks build tests #blackbox #b_build", function() end) describe("LuaRocks build - more complex tests", function() - - it("LuaRocks build luacheck show downloads test_config", function() - local out = run.luarocks("build luacheck", { LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config_show_downloads.lua"} ) - print(out) - end) - + if test_env.TYPE_TEST_ENV == "full" then + it("LuaRocks build luacheck show downloads test_config", function() + local output = run.luarocks("build luacheck", { LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config_show_downloads.lua"} ) + assert.is.truthy(output:match("%.%.%.")) + end) + end + it("LuaRocks build luasec only deps", function() - assert.is_true(run.luarocks_bool("build luasec --only-deps")) + assert.is_true(run.luarocks_bool(test_env.quiet("build luasec --only-deps"))) assert.is_false(run.luarocks_bool("show luasec")) assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec")) end) it("LuaRocks build only deps of downloaded rockspec of lxsh", function() assert.is_true(run.luarocks_bool("download --rockspec lxsh 0.8.6-2")) - assert.is_true(run.luarocks_bool("build lxsh-0.8.6-2.rockspec --only-deps")) + assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.rockspec --only-deps")) assert.is_false(run.luarocks_bool("show lxsh")) assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg")) assert.is_true(os.remove("lxsh-0.8.6-2.rockspec")) end) it("LuaRocks build only deps of downloaded rock of lxsh", function() assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6-2")) - assert.is_true(run.luarocks_bool("build lxsh-0.8.6-2.src.rock --only-deps")) + assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.src.rock --only-deps")) assert.is_false(run.luarocks_bool("show lxsh")) assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg")) assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) end) @@ -151,7 +153,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) - assert.is_true(run.luarocks_bool("show validate-args")) + assert.is.truthy(run.luarocks("show validate-args")) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args")) assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) @@ -159,10 +161,10 @@ describe("LuaRocks build tests #blackbox #b_build", function() it("LuaRocks build with https", function() assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) - assert.is_true(run.luarocks_bool("install luasec")) + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) - assert.is_true(run.luarocks_bool("show validate-args")) + assert.is.truthy(run.luarocks("show validate-args")) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args")) assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) diff --git a/spec/help_spec.lua b/spec/help_spec.lua index 0d41e2e9..88aa5030 100644 --- a/spec/help_spec.lua +++ b/spec/help_spec.lua @@ -10,7 +10,7 @@ describe("LuaRocks help tests #blackbox #b_help", function() end) it("LuaRocks help with no flags/arguments", function() - assert.is_true(run.luarocks_bool("help")) + assert.is_true(run.luarocks_bool(test_env.quiet("help"))) end) it("LuaRocks help invalid argument", function() @@ -18,10 +18,10 @@ describe("LuaRocks help tests #blackbox #b_help", function() end) it("LuaRocks help config", function() - assert.is_true(run.luarocks_bool("help config")) + assert.is_true(run.luarocks_bool(test_env.quiet("help config"))) end) it("LuaRocks-admin help with no flags/arguments", function() - assert.is_true(run.luarocks_admin_bool("help")) + assert.is_true(run.luarocks_admin_bool(test_env.quiet("help"))) end) end) diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 28e349c3..bd480c21 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -73,31 +73,31 @@ describe("LuaRocks install tests #blackbox #b_install", function() describe("LuaRocks install - more complex tests", function() it('LuaRocks install luasec with skipping dependency checks', function() - run.luarocks(" install luasec --nodeps") - assert.is_true(run.luarocks_bool("show luasec")) + run.luarocks_bool(test_env.quiet(" install luasec --nodeps")) + assert.is_true(run.luarocks_bool(test_env.quiet("show luasec"))) if env_variables.TYPE_TEST_ENV == "minimal" then - assert.is_false(run.luarocks_bool("show luasocket")) + assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) end assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec")) end) it("LuaRocks install only-deps of luasocket packed rock", function() - assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket 3.0rc1-1")) + assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-1"))) local output = run.luarocks("install --only-deps " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock") assert.are.same(output, "Successfully installed dependencies for luasocket 3.0rc1-1") assert.is_true(os.remove("luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) end) it("LuaRocks install reinstall", function() - assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket 3.0rc1-1")) + assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-1"))) assert.is_true(run.luarocks_bool("install " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) assert.is_true(run.luarocks_bool("install --deps-mode=none " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) assert.is_true(os.remove("luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) end) it("LuaRocks install binary rock of cprint", function() - assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint")) + assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock cprint"))) assert.is_true(run.luarocks_bool("install cprint-0.1-2." .. test_env.platform .. ".rock")) assert.is_true(os.remove("cprint-0.1-2." .. test_env.platform .. ".rock")) end) diff --git a/spec/make_spec.lua b/spec/make_spec.lua index 3e843f7b..e684033a 100644 --- a/spec/make_spec.lua +++ b/spec/make_spec.lua @@ -30,10 +30,10 @@ describe("LuaRocks make tests #blackbox #b_make", function() assert.is_true(run.luarocks_bool("download --source luasocket 3.0rc1-1")) assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-1.src.rock")) lfs.chdir("luasocket-3.0rc1-1/luasocket-3.0-rc1/") - assert.is_true(run.luarocks_bool("make luasocket-3.0rc1-1.rockspec")) + assert.is_true(run.luarocks_bool(test_env.quiet("make luasocket-3.0rc1-1.rockspec"))) -- test it - assert.is_true(run.luarocks_bool("show luasocket")) + assert.is_true(run.luarocks_bool(test_env.quiet("show luasocket"))) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) -- delete downloaded and unpacked files @@ -61,7 +61,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() assert.is_true(run.luarocks_bool("new_version lxsh-0.8.6-2.rockspec")) assert.is_true(run.luarocks_bool("make")) - assert.is_true(run.luarocks_bool("show lxsh")) + assert.is_true(run.luarocks_bool(test_env.quiet("show lxsh"))) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) end) @@ -69,7 +69,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() os.execute("cp lxsh-0.8.6-2.rockspec rockspec") --rewrite with lfs assert.is_true(run.luarocks_bool("make")) - assert.is_true(run.luarocks_bool("show lxsh")) + assert.is_true(run.luarocks_bool(test_env.quiet("show lxsh"))) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) end) @@ -91,7 +91,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() end) it("LuaRocks make pack binary rock", function() - assert.is_true(run.luarocks_bool("make --deps-mode=none --pack-binary-rock")) + assert.is_true(run.luarocks_bool(test_env.quiet("make --deps-mode=none --pack-binary-rock"))) assert.is.truthy(lfs.attributes("lxsh-0.8.6-2.all.rock")) end) end) diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 78aab9aa..0e5b31c6 100644 --- a/spec/pack_spec.lua +++ b/spec/pack_spec.lua @@ -24,8 +24,7 @@ describe("LuaRocks pack tests #blackbox #b_pack", function() end) it("LuaRocks pack basic", function() - assert.is_true(run.luarocks_bool("list")) - assert.is_true(run.luarocks_bool("pack luacov")) + assert.is_true(run.luarocks_bool(test_env.quiet("pack luacov"))) assert.is_true(test_env.remove_files(lfs.currentdir(), "luacov-")) end) @@ -49,9 +48,8 @@ describe("LuaRocks pack tests #blackbox #b_pack", function() assert.is_false(run.luarocks_bool("pack say")) end) - it("LuaRocks pack src", function() - assert.is_true(run.luarocks_bool("install luasec")) + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) assert.is_true(run.luarocks_bool("download --rockspec luasocket 3.0rc1-1")) assert.is_true(run.luarocks_bool("pack luasocket-3.0rc1-1.rockspec")) assert.is_true(test_env.remove_files(lfs.currentdir(), "luasocket-")) diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua index c7f83b95..7bf1bb10 100644 --- a/spec/remove_spec.lua +++ b/spec/remove_spec.lua @@ -45,7 +45,7 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() describe("LuaRocks remove more complex tests", function() before_each(function() - assert.is_true(test_env.need_rock("luasocket")) + assert.is.truthy(test_env.need_rock("luasocket")) end) it("LuaRocks remove fail, break dependencies", function() diff --git a/spec/search_spec.lua b/spec/search_spec.lua index 33c49856..b31624b8 100644 --- a/spec/search_spec.lua +++ b/spec/search_spec.lua @@ -30,11 +30,7 @@ describe("LuaRocks search tests #blackbox #b_search", function() end) it("LuaRocks search with flag all", function() - assert.is_true(run.luarocks_bool("search --all")) + assert.is_true(run.luarocks_bool(test_env.quiet("search --all"))) end) - it("LuaRocks search zlib", function() - local num = 123 - assert.is_true(run.luarocks_bool("search " .. num)) - end) end) diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index 02b68611..c68a1cdf 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua @@ -53,7 +53,7 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() describe("LuaRocks upload tests with Xavante server #mock", function() before_each(function() - assert.is_true(test_env.need_rock("restserver-xavante")) + assert.is.truthy(test_env.need_rock("restserver-xavante")) 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) @@ -63,10 +63,10 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() end) it("LuaRocks upload rockspec with api-key", function() - assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-1.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) + assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) end) it("LuaRocks upload rockspec with api-key and skip-pack", function() - assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-1.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) + assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) end) end) end) diff --git a/spec/util_spec.lua b/spec/util_spec.lua index 9118ffc9..23e3ebd8 100644 --- a/spec/util_spec.lua +++ b/spec/util_spec.lua @@ -34,13 +34,16 @@ describe("Basic tests #blackbox #b_util", function() local delete_path = lfs.currentdir() assert.is_true(os.remove(delete_path)) - assert.is_false(run.luarocks_bool(" ")) + local output = run.luarocks("") + assert.is.falsy(output:find("LuaRocks scm, a module deployment system for Lua")) assert.is_true(lfs.chdir(main_path)) - assert.is_true(run.luarocks_bool(" ")) + + output = run.luarocks("") + assert.is.truthy(output:find("LuaRocks scm, a module deployment system for Lua")) end) it("LuaRocks timeout", function() - assert.is_true(run.luarocks_bool("--timeout=10")) + assert.is.truthy(run.luarocks("--timeout=10")) end) it("LuaRocks timeout invalid", function() @@ -48,7 +51,7 @@ describe("Basic tests #blackbox #b_util", function() end) it("LuaRocks only server=testing", function() - assert.is_true(run.luarocks_bool("--only-server=testing")) + assert.is.truthy(run.luarocks("--only-server=testing")) end) it("LuaRocks test site config", function() @@ -56,7 +59,7 @@ describe("Basic tests #blackbox #b_util", function() assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua")) assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua.tmp")) - assert.is_true(run.luarocks_bool("")) + assert.is.truthy(run.luarocks("")) assert.is.truthy(os.rename("src/luarocks/site_config.lua.tmp", "src/luarocks/site_config.lua")) assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua.tmp")) diff --git a/spec/write_rockspec_spec.lua b/spec/write_rockspec_spec.lua index 85e345d5..531d11eb 100644 --- a/spec/write_rockspec_spec.lua +++ b/spec/write_rockspec_spec.lua @@ -64,8 +64,7 @@ describe("LuaRocks write_rockspec tests #blackbox #b_write_rockspec", function() end) it("LuaRocks write_rockspec git luafcgi with many flags", function() - assert.is_true(run.luarocks_bool("write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license=\"3-clause BSD\" " - .. "--lua-version=5.1,5.2")) + assert.is_true(run.luarocks_bool("write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license=\"3-clause BSD\" " .. "--lua-version=5.1,5.2")) assert.is.truthy(lfs.attributes("luafcgi-scm-1.rockspec")) -- TODO maybe read it content and find arguments from flags? assert.is_true(os.remove("luafcgi-scm-1.rockspec")) end) -- cgit v1.2.3-55-g6feb