mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 07:30:41 +09:00
Merge remote-tracking branch 'origin/master' into host-pairing
# Conflicts: # test/integration/clusterio.js
This commit is contained in:
36 files changed
+661
-307
No files matched your search
@@ -302,8 +302,7 @@ describe("host/src/Host", function() {
|
||||
await host.loadPlugins();
|
||||
const plugins = await host.handlePluginListRequest(new lib.PluginListRequest());
|
||||
const plugin = plugins.find(candidate => candidate.name === "controller_only");
|
||||
assert.equal(plugin.loaded, false);
|
||||
assert.equal(plugin.noEntrypoint, true);
|
||||
assert.equal(plugin.state, "noEntrypoint");
|
||||
const [entry] = computePluginStatuses([
|
||||
{ name: "host", isController: false, address: { hostId: 1 }, plugins: [plugin] },
|
||||
]).get("controller_only").machines;
|
||||
|
||||
@@ -268,6 +268,46 @@ describe("class Instance", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe(".handleInstanceStopRequest()", function() {
|
||||
let calls;
|
||||
beforeEach(function() {
|
||||
calls = [];
|
||||
instance.server._state = "running";
|
||||
instance.server.stop = async () => { calls.push("stop"); instance.server._state = "stopping"; };
|
||||
instance.server.kill = async () => { calls.push("kill"); };
|
||||
instance.sendSaveListUpdate = async () => {};
|
||||
});
|
||||
|
||||
it("should stop once a start in progress finishes", async function() {
|
||||
instance.notifyStatus("starting");
|
||||
let stopped = instance.handleInstanceStopRequest();
|
||||
await wait(10);
|
||||
assert.deepEqual(calls, [], "stopped while starting");
|
||||
instance.notifyStatus("running");
|
||||
await stopped;
|
||||
assert.deepEqual(calls, ["stop"]);
|
||||
});
|
||||
|
||||
it("should do nothing if a start in progress fails", async function() {
|
||||
instance.notifyStatus("starting");
|
||||
let stopped = instance.handleInstanceStopRequest();
|
||||
await wait(10);
|
||||
instance.notifyStatus("stopped");
|
||||
await stopped;
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
it("should not kill the server when stopped while stopping", async function() {
|
||||
instance.notifyStatus("running");
|
||||
let first = instance.handleInstanceStopRequest();
|
||||
let second = instance.handleInstanceStopRequest();
|
||||
await first;
|
||||
instance.notifyStatus("stopped");
|
||||
await second;
|
||||
assert.deepEqual(calls, ["stop"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe(".checkModPackVersion()", function() {
|
||||
function modPack(factorioVersion) {
|
||||
return lib.ModPack.fromJSON({ name: "pack", factorio_version: factorioVersion });
|
||||
|
||||
Reference in new issue
Block a user