From c41e1ca11fe1766451a0ccfa0767b8105350ad28 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 25 Aug 2022 18:48:06 -0300 Subject: tests: only run luasocket rollback test on minimal environment --- spec/install_spec.lua | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'spec') diff --git a/spec/install_spec.lua b/spec/install_spec.lua index c3aa0064..d410ca97 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -214,36 +214,38 @@ describe("luarocks install #integration", function() end) it("installation rolls back on failure", function() - assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket ${LUASOCKET}")) - local luadir = testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION - lfs.mkdir(luadir) + if test_env.TYPE_TEST_ENV ~= "full" then + assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket ${LUASOCKET}")) + local luadir = testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION + lfs.mkdir(luadir) - run.luarocks_bool("remove " .. "luasocket") + run.luarocks_bool("remove " .. "luasocket") - -- create a file where a folder should be - local fd = io.open(luadir .. "/socket", "w") - fd:write("\n") - fd:close() + -- create a file where a folder should be + local fd = io.open(luadir .. "/socket", "w") + fd:write("\n") + fd:close() - -- try to install and fail - assert.is_false(run.luarocks_bool("install " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) + -- try to install and fail + assert.is_false(run.luarocks_bool("install " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) - -- file is still there - assert.is.truthy(lfs.attributes(luadir .. "/socket")) - -- no left overs from failed installation - assert.is.falsy(lfs.attributes(luadir .. "/mime.lua")) + -- file is still there + assert.is.truthy(lfs.attributes(luadir .. "/socket")) + -- no left overs from failed installation + assert.is.falsy(lfs.attributes(luadir .. "/mime.lua")) - -- remove file - assert.is_true(os.remove(luadir .. "/socket")) + -- remove file + assert.is_true(os.remove(luadir .. "/socket")) - -- try again and succeed - assert.is_true(run.luarocks_bool("install " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) + -- try again and succeed + assert.is_true(run.luarocks_bool("install " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) - -- files installed successfully - assert.is.truthy(lfs.attributes(luadir .. "/socket/ftp.lua")) - assert.is.truthy(lfs.attributes(luadir .. "/mime.lua")) + -- files installed successfully + assert.is.truthy(lfs.attributes(luadir .. "/socket/ftp.lua")) + assert.is.truthy(lfs.attributes(luadir .. "/mime.lua")) - assert.is_true(os.remove("luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) + assert.is_true(os.remove("luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) + end end) it("binary rock of cprint", function() -- cgit v1.2.3-55-g6feb