mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 00:13:12 +09:00
Merge pull request #384 from Hornwitser/test-fixes
Fix tests on Windows and remove internet requirement to pass
This commit is contained in:
3 files changed
+15
No files matched your search
@@ -176,10 +176,18 @@ describe("Integration of Clusterio", function() {
|
|||||||
|
|
||||||
describe("instance create", function() {
|
describe("instance create", function() {
|
||||||
it("creates the instance", async function() {
|
it("creates the instance", async function() {
|
||||||
|
this.timeout(6000);
|
||||||
await execCtl("instance create test --id 44");
|
await execCtl("instance create test --id 44");
|
||||||
let instances = await getInstances();
|
let instances = await getInstances();
|
||||||
assert(instances.has(44), "instance was not created");
|
assert(instances.has(44), "instance was not created");
|
||||||
assert.equal(instances.get(44).status, "unassigned", "incorrect instance status");
|
assert.equal(instances.get(44).status, "unassigned", "incorrect instance status");
|
||||||
|
|
||||||
|
// Make sure the following tests does not fail due to not having internet
|
||||||
|
let value = JSON.stringify({ lan: true, public: false }).replace(
|
||||||
|
/"/g, process.platform === "win32" ? '""' : '\\"'
|
||||||
|
);
|
||||||
|
await execCtl(`instance config set-prop test factorio.settings visibility "'${value}'"`);
|
||||||
|
await execCtl("instance config set-prop test factorio.settings require_user_verification false");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,12 @@ describe("Integration of lib/factorio/server", function() {
|
|||||||
slowTest(this);
|
slowTest(this);
|
||||||
log(".start()");
|
log(".start()");
|
||||||
|
|
||||||
|
// Make sure the test does not fail due to not having internet
|
||||||
|
let settings = await server.exampleSettings();
|
||||||
|
settings.visibility = { public: false, lan: true };
|
||||||
|
settings.require_user_verification = false;
|
||||||
|
await fs.outputFile(server.writePath("server-settings.json"), JSON.stringify(settings, null, 4));
|
||||||
|
|
||||||
// Make sure the test does not fail due to create() failing.
|
// Make sure the test does not fail due to create() failing.
|
||||||
let mapPath = server.writePath("saves", "test.zip");
|
let mapPath = server.writePath("saves", "test.zip");
|
||||||
assert(await fs.exists(mapPath), "save is missing");
|
assert(await fs.exists(mapPath), "save is missing");
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ function serverSuite(proto) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should refuse connection if request sent after starting closure", async function() {
|
it("should refuse connection if request sent after starting closure", async function() {
|
||||||
|
this.timeout(4000); // On Windows this test takes 2 seconds for some reason.
|
||||||
server.on("request", (request, response) => {
|
server.on("request", (request, response) => {
|
||||||
setTimeout(() => { response.end("ok-4"); }, 3*tick);
|
setTimeout(() => { response.end("ok-4"); }, 3*tick);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user