From 55f3dac9b68b40a40d25a0c8381300bde09a2d1d Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Wed, 9 Jun 2021 13:49:05 +0200 Subject: [PATCH] Fix integration tests requiring internet to work When factorio starts up with with the require_user_verification setting turn on it tries to obtain a server padlock from the matchmaking server and will fail if this does not succeed. Turn off user verification and public visibility which require user verification both of which are on by default for the integration tests so that they work without internet. --- test/integration/clusterio.js | 8 ++++++++ test/integration/server.js | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/test/integration/clusterio.js b/test/integration/clusterio.js index c73c3d32..fdd50170 100644 --- a/test/integration/clusterio.js +++ b/test/integration/clusterio.js @@ -123,10 +123,18 @@ describe("Integration of Clusterio", function() { describe("instance create", function() { it("creates the instance", async function() { + this.timeout(6000); await execCtl("instance create test --id 44"); let instances = await getInstances(); assert(instances.has(44), "instance was not created"); 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"); }); }); diff --git a/test/integration/server.js b/test/integration/server.js index 5d375e38..b4f1adb6 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -103,6 +103,12 @@ describe("Integration of lib/factorio/server", function() { slowTest(this); 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. let mapPath = server.writePath("saves", "test.zip"); assert(await fs.exists(mapPath), "save is missing");