mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-15 23:24:52 +09:00
Fix tests failing due broken Factorio detection (#839)
* Fix tests failing due to missmatched Factorio detection When the configured factorio directory is full of junk then the tests use the first directory it finds for one of its tests, while the server code uses a more elaborate logic to figure this out. Turns out this is complicating things more than needed. Simply trying each entry in the directory and seeing if it works when treated as a directory always work, regardsless of symlinks, junctions, reparse-points or whatever else filesystem magic there is. * Skip tests requiring Factorio if it's not present Prevent confusing test failures by skipping all the tests that require a working Factorio installation to sucteed, and print a warning at the end of the test suite if tests may have been skipped due to this. * Handle ENOTDIR when determining Factorio version If the path to the factorio install contains a component that is not a file then ENOTDIR may be returned on POSIX like systems. Treat this the same as ENOENT so that detection logic works when used on a file. --------- Co-authored-by: Hornwitser <code@hornwitser.no>
This commit is contained in:
1 parent
6733aed3fb
commit
94692dc418
6 files changed
+66
-30
No files matched your search
@@ -5,6 +5,7 @@ const lib = require("@clusterio/lib");
|
||||
const { testMatrix } = require("../common");
|
||||
const {
|
||||
slowTest, exec, execCtl, execCtlProcess, sendRcon, getControl,
|
||||
requiresFactorio, hasFactorio,
|
||||
} = require("./index");
|
||||
|
||||
const instId = 48;
|
||||
@@ -24,6 +25,7 @@ function getUser(name) {
|
||||
}
|
||||
|
||||
describe("Clusterio Instance", function() {
|
||||
requiresFactorio(this);
|
||||
before(async function() {
|
||||
this.timeout(20000);
|
||||
const visibility = JSON.stringify({ lan: true, public: false }).replace(
|
||||
@@ -56,6 +58,9 @@ describe("Clusterio Instance", function() {
|
||||
await execCtl(`instance start ${instAltName}`);
|
||||
});
|
||||
after(async function() {
|
||||
if (!hasFactorio()) {
|
||||
return;
|
||||
}
|
||||
this.timeout(20000);
|
||||
// Delete the instances
|
||||
await execCtl(`instance delete ${instName}`);
|
||||
@@ -186,6 +191,7 @@ describe("Clusterio Instance", function() {
|
||||
}
|
||||
});
|
||||
describe("start-all and stop-all commands", function() {
|
||||
requiresFactorio(this);
|
||||
// Test instance IDs for start-all/stop-all tests
|
||||
const testInstId1 = 50;
|
||||
const testInstId2 = 51;
|
||||
|
||||
Reference in new issue
Block a user