Fix fast-test

Fix incorrect locations for slowTest in clusterio integration tests and
add slowTest to the patch integration tests.  Fixes fast-test being
broken.
This commit is contained in:
Hornwitser committed 2019-12-14 17:53:34 +01:00
1 parent b71c392b32
commit 8b9bb59357
2 files changed
+14 -5

No files matched your search

+5 -5
View File
@@ -88,39 +88,39 @@ describe("Integration of Clusterio", function() {
}); });
describe("create-save", function() { describe("create-save", function() {
slowTest(this);
it("creates a save", async function() { it("creates a save", async function() {
slowTest(this);
await clusterctl._commands.get("create-save").run({instance: "test"}, testControl); await clusterctl._commands.get("create-save").run({instance: "test"}, testControl);
}); });
}); });
describe("start-instance", function() { describe("start-instance", function() {
slowTest(this);
it("starts the instance", async function() { it("starts the instance", async function() {
slowTest(this);
await clusterctl._commands.get("start-instance").run({instance: "test"}, testControl); await clusterctl._commands.get("start-instance").run({instance: "test"}, testControl);
// TODO check that the instance actually stopped // TODO check that the instance actually stopped
}); });
}); });
describe("send-rcon", function() { describe("send-rcon", function() {
slowTest(this);
it("sends the command", async function() { it("sends the command", async function() {
slowTest(this);
await clusterctl._commands.get("send-rcon").run({instance: "test", command: "test"}, testControl); await clusterctl._commands.get("send-rcon").run({instance: "test", command: "test"}, testControl);
// TODO check that the command was received // TODO check that the command was received
}); });
}); });
describe("stop-instance", function() { describe("stop-instance", function() {
slowTest(this);
it("stops the instance", async function() { it("stops the instance", async function() {
slowTest(this);
await clusterctl._commands.get("stop-instance").run({instance: "test"}, testControl); await clusterctl._commands.get("stop-instance").run({instance: "test"}, testControl);
// TODO check that the instance actually stopped // TODO check that the instance actually stopped
}); });
}); });
describe("delete-instance", function() { describe("delete-instance", function() {
slowTest(this);
it("deletes the instance", async function() { it("deletes the instance", async function() {
slowTest(this);
await clusterctl._commands.get("delete-instance").run({instance: "test"}, testControl); await clusterctl._commands.get("delete-instance").run({instance: "test"}, testControl);
assert(!await fs.exists(path.join(instancesDir, "test")), "Instance was not deleted"); assert(!await fs.exists(path.join(instancesDir, "test")), "Instance was not deleted");
}); });
+9
View File
@@ -10,9 +10,17 @@ const factorio = require("lib/factorio");
require("./server") require("./server")
describe("Integration of lib/factorio/patch", function() { describe("Integration of lib/factorio/patch", function() {
// Mark that this test depeneds on a test that takes a lot of time.
function slowTest(test) {
if (process.env.FAST_TEST) {
test.skip();
}
}
describe("patch()", function() { describe("patch()", function() {
let savePath = path.join("test", "temp", "integration", "saves", "test.zip"); let savePath = path.join("test", "temp", "integration", "saves", "test.zip");
it("should patch a freeplay game", async function() { it("should patch a freeplay game", async function() {
slowTest(this);
await factorio.patch(savePath, [{ await factorio.patch(savePath, [{
name: "test", name: "test",
files: [{ path: "test.lua", content: "-- test" }] files: [{ path: "test.lua", content: "-- test" }]
@@ -23,6 +31,7 @@ describe("Integration of lib/factorio/patch", function() {
assert.equal(content, "-- test"); assert.equal(content, "-- test");
}); });
it("should remove old modules in a save", async function() { it("should remove old modules in a save", async function() {
slowTest(this);
await factorio.patch(savePath, [{ name: "test", files: [] }]); await factorio.patch(savePath, [{ name: "test", files: [] }]);
let zip = await jszip.loadAsync(await fs.readFile(savePath)); let zip = await jszip.loadAsync(await fs.readFile(savePath));
assert.equal(zip.file("test/modules/test.lua"), null); assert.equal(zip.file("test/modules/test.lua"), null);