File

spec/util_envload_spec.lua @ 13651:b9d369f77121

prosodyctl: Further deprecate start/stop/restart commands when installed Despite the warning we introduced, many people continue to try using prosodyctl to manage Prosody in the presence of systemctl (e.g. #1688). Also, despite the warning, prosodyctl proceeded with the operation. This means the commands could be invoked by accident, and cause a situation that is hard to recover from (needing to manually track down stray processes). This commit disables all the problematic commands by default, but this can still be overridden using --force or via a config option. We only perform this check when we believe Prosody has been "installed" for system-wide use (i.e. running it from a source directory is still supported).
author Matthew Wild <mwild1@gmail.com>
date Thu, 06 Feb 2025 14:51:31 +0000
parent 11489:37f49d0ad22c
line wrap: on
line source

describe("util.envload", function()
	local envload = require "util.envload";
	describe("envload()", function()
		it("works", function()
			local f, err = envload.envload("return 'hello'", "@test", {});
			assert.is_function(f, err);
			local ok, ret = pcall(f);
			assert.truthy(ok);
			assert.equal("hello", ret);
		end);
		it("lets you pass values in and out", function ()
			local f, err = envload.envload("return thisglobal", "@test", { thisglobal = "yes, this one" });
			assert.is_function(f, err);
			local ok, ret = pcall(f);
			assert.truthy(ok);
			assert.equal("yes, this one", ret);

		end);

	end)
	-- TODO envloadfile()
end)