fix(startup): shut down after server exit
This commit is contained in:
parent
38addf85fd
commit
d7ec0bef1c
@ -1,4 +1,4 @@
|
|||||||
local _VERSION = '1.3.1'
|
local _VERSION = '1.3.2'
|
||||||
|
|
||||||
local LOCAL_MANIFEST_PATH = '/trapos/manifest.json';
|
local LOCAL_MANIFEST_PATH = '/trapos/manifest.json';
|
||||||
|
|
||||||
@ -56,3 +56,5 @@ if #SERVERS > 0 then
|
|||||||
end
|
end
|
||||||
|
|
||||||
parallel.waitForAll(shellFn, table.unpack(servers));
|
parallel.waitForAll(shellFn, table.unpack(servers));
|
||||||
|
|
||||||
|
os.shutdown();
|
||||||
|
|||||||
@ -5,6 +5,7 @@ local testlib = createLibTest({ ... });
|
|||||||
local function runStartupWithStubs()
|
local function runStartupWithStubs()
|
||||||
local calls = {
|
local calls = {
|
||||||
rebooted = false,
|
rebooted = false,
|
||||||
|
shutdown = false,
|
||||||
shellRuns = {},
|
shellRuns = {},
|
||||||
prints = {},
|
prints = {},
|
||||||
};
|
};
|
||||||
@ -19,6 +20,9 @@ local function runStartupWithStubs()
|
|||||||
reboot = function()
|
reboot = function()
|
||||||
calls.rebooted = true;
|
calls.rebooted = true;
|
||||||
end,
|
end,
|
||||||
|
shutdown = function()
|
||||||
|
calls.shutdown = true;
|
||||||
|
end,
|
||||||
sleep = function() end,
|
sleep = function() end,
|
||||||
},
|
},
|
||||||
parallel = {
|
parallel = {
|
||||||
@ -54,10 +58,11 @@ local function runStartupWithStubs()
|
|||||||
return calls;
|
return calls;
|
||||||
end
|
end
|
||||||
|
|
||||||
testlib.test('shell exit does not force reboot', function()
|
testlib.test('shell exit shuts down without rebooting', function()
|
||||||
local calls = runStartupWithStubs();
|
local calls = runStartupWithStubs();
|
||||||
|
|
||||||
testlib.assertEquals(calls.shellRuns[1], 'shell');
|
testlib.assertEquals(calls.shellRuns[1], 'shell');
|
||||||
|
testlib.assertEquals(calls.shutdown, true);
|
||||||
testlib.assertEquals(calls.rebooted, false);
|
testlib.assertEquals(calls.rebooted, false);
|
||||||
for _, message in ipairs(calls.prints) do
|
for _, message in ipairs(calls.prints) do
|
||||||
testlib.assertTrue(
|
testlib.assertTrue(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user