mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 15:04:52 +09:00
Enable skipped tests on Windows
Use the stop host command to stop alt-host so that the tests that depend on it can also be run on Windows.
This commit is contained in:
1 parent
a05aef260f
commit
8e21290b22
3 files changed
+16
-43
No files matched your search
@@ -211,9 +211,6 @@ describe("host/server", function() {
|
||||
|
||||
describe(".stop()", function() {
|
||||
it("should handle server quitting on its own during stop", async function() {
|
||||
if (process.platform === "win32") {
|
||||
this.skip();
|
||||
}
|
||||
server.hangTimeoutMs = 20;
|
||||
server._server = new events.EventEmitter();
|
||||
server._server.kill = () => true;
|
||||
|
||||
@@ -48,8 +48,21 @@ async function startAltHost() {
|
||||
|
||||
async function stopAltHost(hostProcess) {
|
||||
if (hostProcess && hostProcess.exitCode === null) {
|
||||
hostProcess.kill("SIGINT");
|
||||
await events.once(hostProcess, "exit");
|
||||
const waitForExit = lib.timeout(
|
||||
events.once(hostProcess, "exit"),
|
||||
10e3,
|
||||
"timeout"
|
||||
).catch(() => {});
|
||||
try {
|
||||
await execCtl("host stop 5");
|
||||
} catch (err) {
|
||||
// Some tests cause the host to stop
|
||||
}
|
||||
if (await waitForExit === "timeout" && hostProcess.exitCode === null) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn("Stopping alt-host failed. Killing.");
|
||||
hostProcess.kill("SIGINT");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,12 +161,6 @@ describe("Integration of Clusterio", function() {
|
||||
describe("clusteriohost", function() {
|
||||
describe("hostUpdateEventHandler()", function() {
|
||||
it("should trigger when a new host is added", async function() {
|
||||
// On windows there's currently no way to automate graceful shutdown of the host
|
||||
// process as CTRL+C is some weird terminal thing and SIGINT isn't a thing.
|
||||
if (process.platform === "win32") {
|
||||
this.skip();
|
||||
}
|
||||
|
||||
slowTest(this);
|
||||
getControl().hostUpdates = [];
|
||||
|
||||
@@ -189,12 +196,6 @@ describe("Integration of Clusterio", function() {
|
||||
});
|
||||
});
|
||||
it("should download mods from controller", async function() {
|
||||
// On windows there's currently no way to automate graceful shutdown of the host
|
||||
// process as CTRL+C is some weird terminal thing and SIGINT isn't a thing.
|
||||
if (process.platform === "win32") {
|
||||
this.skip();
|
||||
}
|
||||
|
||||
slowTest(this);
|
||||
await runWithAltHost(async () => {
|
||||
const clusterioLib = path.join("temp", "test", "alt-mods", "clusterio_lib_0.1.2.zip");
|
||||
@@ -206,12 +207,6 @@ describe("Integration of Clusterio", function() {
|
||||
});
|
||||
});
|
||||
it("should auto start instances with auto_start enabled", async function() {
|
||||
// On windows there's currently no way to automate graceful shutdown of the host
|
||||
// process as CTRL+C is some weird terminal thing and SIGINT isn't a thing.
|
||||
if (process.platform === "win32") {
|
||||
this.skip();
|
||||
}
|
||||
|
||||
slowTest(this);
|
||||
|
||||
let hostProcess;
|
||||
@@ -310,12 +305,6 @@ describe("Integration of Clusterio", function() {
|
||||
});
|
||||
describe("host revoke-token", async function() {
|
||||
it("should disconnect existing host", async function() {
|
||||
// On windows there's currently no way to automate graceful shutdown of the host
|
||||
// process as CTRL+C is some weird terminal thing and SIGINT isn't a thing.
|
||||
if (process.platform === "win32") {
|
||||
this.skip();
|
||||
}
|
||||
|
||||
slowTest(this);
|
||||
let sawDisconnected;
|
||||
await runWithAltHost(async () => {
|
||||
@@ -774,11 +763,6 @@ describe("Integration of Clusterio", function() {
|
||||
if (remote) {
|
||||
let hostProcess;
|
||||
before(async function() {
|
||||
// On windows there's currently no way to automate graceful shutdown of the host
|
||||
// process as CTRL+C is some weird terminal thing and SIGINT isn't a thing.
|
||||
if (process.platform === "win32") {
|
||||
this.skip();
|
||||
}
|
||||
slowTest(this);
|
||||
|
||||
hostProcess = await startAltHost();
|
||||
@@ -907,12 +891,8 @@ describe("Integration of Clusterio", function() {
|
||||
slowTest(this);
|
||||
let statusesToCheck = new Set([
|
||||
"unassigned", "stopped", "creating_save", "exporting_data",
|
||||
"starting", "running", "stopping", "deleted",
|
||||
"starting", "running", "stopping", "deleted", "unknown",
|
||||
]);
|
||||
// Windows does not see the unknown status because alt-host is not spawned.
|
||||
if (process.platform !== "win32") {
|
||||
statusesToCheck.add("unknown");
|
||||
}
|
||||
let statusesNotSeen = new Set(statusesToCheck);
|
||||
|
||||
for (let update of getControl().instanceUpdates) {
|
||||
|
||||
@@ -219,10 +219,6 @@ describe("Integration of host/src/server", function() {
|
||||
|
||||
describe(".start() termination detection", function() {
|
||||
it("should tell if Factorio got killed", async function() {
|
||||
// This does not work on Windows
|
||||
if (process.platform === "win32") {
|
||||
this.skip();
|
||||
}
|
||||
slowTest(this);
|
||||
log(".start() for kill detection");
|
||||
|
||||
|
||||
Reference in new issue
Block a user