mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 00:13:13 +09:00
Fix failing tests
This commit is contained in:
2 files changed
+41
-8
No files matched your search
@@ -763,9 +763,25 @@ describe("Integration of Clusterio", function() {
|
|||||||
|
|
||||||
describe("instance send-rcon", function() {
|
describe("instance send-rcon", function() {
|
||||||
requiresFactorio(this);
|
requiresFactorio(this);
|
||||||
|
const plugins = [
|
||||||
|
"global_chat", "inventory_sync", "player_auth",
|
||||||
|
"research_sync", "statistics_exporter", "subspace_storage",
|
||||||
|
];
|
||||||
|
this.beforeAll(async function() {
|
||||||
|
this.timeout(10000);
|
||||||
|
// Disable plugins as they interfere with enable_script_commands test
|
||||||
|
for (const plugin of plugins) {
|
||||||
|
await execCtl(`instance config set test ${plugin}.load_plugin false`);
|
||||||
|
}
|
||||||
|
});
|
||||||
this.afterAll(async function() {
|
this.afterAll(async function() {
|
||||||
|
this.timeout(10000);
|
||||||
// Prevents cascading failure where enable_script_commands is expected to be true
|
// Prevents cascading failure where enable_script_commands is expected to be true
|
||||||
await execCtl("instance config set test factorio.enable_script_commands true");
|
await execCtl("instance config set test factorio.enable_script_commands true");
|
||||||
|
// Enable plugins after they were previously disabled
|
||||||
|
for (const plugin of plugins) {
|
||||||
|
await execCtl(`instance config set test ${plugin}.load_plugin true`);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
it("sends the command", async function() {
|
it("sends the command", async function() {
|
||||||
slowTest(this);
|
slowTest(this);
|
||||||
@@ -1097,12 +1113,12 @@ describe("Integration of Clusterio", function() {
|
|||||||
it("starts the instance with the given settings", async function() {
|
it("starts the instance with the given settings", async function() {
|
||||||
slowTest(this);
|
slowTest(this);
|
||||||
requiresFactorio(this);
|
requiresFactorio(this);
|
||||||
await execCtl("instance config set 44 factorio.enable_save_patching false");
|
|
||||||
await execCtl("instance config set 44 player_auth.load_plugin false");
|
await execCtl("instance config set 44 player_auth.load_plugin false");
|
||||||
await execCtl("instance config set 44 research_sync.load_plugin false");
|
await execCtl("instance config set 44 research_sync.load_plugin false");
|
||||||
await execCtl("instance config set 44 statistics_exporter.load_plugin false");
|
await execCtl("instance config set 44 statistics_exporter.load_plugin false");
|
||||||
await execCtl("instance config set 44 subspace_storage.load_plugin false");
|
await execCtl("instance config set 44 subspace_storage.load_plugin false");
|
||||||
await execCtl("instance config set 44 inventory_sync.load_plugin false");
|
await execCtl("instance config set 44 inventory_sync.load_plugin false");
|
||||||
|
await execCtl("instance config set 44 factorio.enable_save_patching false");
|
||||||
|
|
||||||
await execCtl("instance start 44");
|
await execCtl("instance start 44");
|
||||||
const instance = (await getInstances()).get(44);
|
const instance = (await getInstances()).get(44);
|
||||||
|
|||||||
@@ -240,16 +240,25 @@ describe("lib/config/definitions/validators", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("plugin.load_plugin", function() {
|
describe("plugin.load_plugin", function() {
|
||||||
class TestInstanceConfig extends InstanceConfig {
|
const initialConfigFields = {
|
||||||
static fieldDefinitions = { ...InstanceConfig.fieldDefinitions };
|
"global_chat.load_plugin": false,
|
||||||
}
|
"inventory_sync.load_plugin": false,
|
||||||
|
"player_auth.load_plugin": false,
|
||||||
|
"research_sync.load_plugin": false,
|
||||||
|
"statistics_exporter.load_plugin": false,
|
||||||
|
"subspace_storage.load_plugin": false,
|
||||||
|
};
|
||||||
it("should validate against factorio.enable_save_patching", function() {
|
it("should validate against factorio.enable_save_patching", function() {
|
||||||
|
class TestInstanceConfig extends InstanceConfig {
|
||||||
|
static fieldDefinitions = { ...InstanceConfig.fieldDefinitions };
|
||||||
|
}
|
||||||
|
|
||||||
lib.addPluginFieldDefinitions(
|
lib.addPluginFieldDefinitions(
|
||||||
{name: "save_patching", features: ["SavePatching"] },
|
{name: "save_patching", features: ["SavePatching"] },
|
||||||
"instanceConfigFields", TestInstanceConfig
|
"instanceConfigFields", TestInstanceConfig
|
||||||
);
|
);
|
||||||
|
|
||||||
const config = new TestInstanceConfig("controller");
|
const config = new TestInstanceConfig("controller", initialConfigFields);
|
||||||
|
|
||||||
// valid: does not require script commands
|
// valid: does not require script commands
|
||||||
assert.doesNotThrow(() => config.set("factorio.enable_script_commands", false));
|
assert.doesNotThrow(() => config.set("factorio.enable_script_commands", false));
|
||||||
@@ -267,12 +276,16 @@ describe("lib/config/definitions/validators", function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
it("should validate against factorio.enable_script_commands", function() {
|
it("should validate against factorio.enable_script_commands", function() {
|
||||||
|
class TestInstanceConfig extends InstanceConfig {
|
||||||
|
static fieldDefinitions = { ...InstanceConfig.fieldDefinitions };
|
||||||
|
}
|
||||||
|
|
||||||
lib.addPluginFieldDefinitions(
|
lib.addPluginFieldDefinitions(
|
||||||
{ name: "script_commands", features: ["ScriptCommands"] },
|
{ name: "script_commands", features: ["ScriptCommands"] },
|
||||||
"instanceConfigFields", TestInstanceConfig
|
"instanceConfigFields", TestInstanceConfig
|
||||||
);
|
);
|
||||||
|
|
||||||
const config = new TestInstanceConfig("controller");
|
const config = new TestInstanceConfig("controller", initialConfigFields);
|
||||||
|
|
||||||
// valid: does not require save patching
|
// valid: does not require save patching
|
||||||
assert.doesNotThrow(() => config.set("factorio.enable_save_patching", false));
|
assert.doesNotThrow(() => config.set("factorio.enable_save_patching", false));
|
||||||
@@ -290,12 +303,16 @@ describe("lib/config/definitions/validators", function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
it("should allow when no feature flags are present", function() {
|
it("should allow when no feature flags are present", function() {
|
||||||
|
class TestInstanceConfig extends InstanceConfig {
|
||||||
|
static fieldDefinitions = { ...InstanceConfig.fieldDefinitions };
|
||||||
|
}
|
||||||
|
|
||||||
lib.addPluginFieldDefinitions(
|
lib.addPluginFieldDefinitions(
|
||||||
{ name: "no_features", features: [] },
|
{ name: "no_features", features: [] },
|
||||||
"instanceConfigFields", TestInstanceConfig
|
"instanceConfigFields", TestInstanceConfig
|
||||||
);
|
);
|
||||||
|
|
||||||
const config = new TestInstanceConfig("controller");
|
const config = new TestInstanceConfig("controller", initialConfigFields);
|
||||||
|
|
||||||
// valid: does not require save patching
|
// valid: does not require save patching
|
||||||
assert.doesNotThrow(() => config.set("factorio.enable_save_patching", false));
|
assert.doesNotThrow(() => config.set("factorio.enable_save_patching", false));
|
||||||
@@ -304,7 +321,7 @@ describe("lib/config/definitions/validators", function() {
|
|||||||
assert.doesNotThrow(() => config.set("factorio.enable_script_commands", false));
|
assert.doesNotThrow(() => config.set("factorio.enable_script_commands", false));
|
||||||
|
|
||||||
// valid: can have load disabled
|
// valid: can have load disabled
|
||||||
assert.doesNotThrow(() => config.set("script_commands.load_plugin", false));
|
assert.doesNotThrow(() => config.set("no_features.load_plugin", false));
|
||||||
|
|
||||||
// no invalid case
|
// no invalid case
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user