mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 07:33:12 +09:00
Copy save if the save to start is an autosave
Prevent potential data loss when starting an autosave by copying it first. This avoids overwriting a random autosave slot when the server shuts down after having loaded an autosave.
This commit is contained in:
1 parent
12db0d5a84
commit
a0f5864324
2 files changed
+29
-2
No files matched your search
@@ -173,11 +173,21 @@ describe("Integration of Clusterio", function() {
|
||||
});
|
||||
|
||||
describe("instance start", function() {
|
||||
it("starts the instance", async function() {
|
||||
it("starts the given save", async function() {
|
||||
slowTest(this);
|
||||
await execCtl("instance start test");
|
||||
await execCtl("instance start test --save world.zip");
|
||||
await checkInstanceStatus(44, "running");
|
||||
});
|
||||
it("copies the save if an autosave is the target", async function() {
|
||||
slowTest(this);
|
||||
await execCtl("instance stop 44");
|
||||
let savesDir = path.join("temp", "test", "instances", "test", "saves");
|
||||
await fs.copy(path.join(savesDir, "world.zip"), path.join(savesDir, "_autosave1.zip"));
|
||||
await execCtl("instance start test");
|
||||
let result = await libLink.messages.listSaves.send(getControl(), { instance_id: 44 });
|
||||
let running = result.list.find(s => s.loaded);
|
||||
assert(running.name !== "_autosave1.zip");
|
||||
});
|
||||
});
|
||||
|
||||
describe("instance send-rcon", function() {
|
||||
|
||||
Reference in new issue
Block a user