Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Hsu <kennethhsu@gmail.com>2020-07-21 22:47:04 +0300
committerKenneth Hsu <kennethhsu@gmail.com>2020-07-21 23:20:42 +0300
commit00cd10062b8183dbc6d662a9b4105b9aafc30ab4 (patch)
tree6277bf7cfb439ed538fa6b0ee7d0043e3e4c5393 /Duplicati/UnitTest
parent77a4918f36a41fe06c52292db830ca08d56ee88f (diff)
Add test to check that only backend files with correct prefix are deleted.
This concerns issue #2678.
Diffstat (limited to 'Duplicati/UnitTest')
-rw-r--r--Duplicati/UnitTest/ControllerTests.cs36
1 files changed, 35 insertions, 1 deletions
diff --git a/Duplicati/UnitTest/ControllerTests.cs b/Duplicati/UnitTest/ControllerTests.cs
index 30c5d90f8..8b9af3e62 100644
--- a/Duplicati/UnitTest/ControllerTests.cs
+++ b/Duplicati/UnitTest/ControllerTests.cs
@@ -51,11 +51,45 @@ namespace Duplicati.UnitTest
}
// After we delete backend files from the second backup configuration, those from the first
- // configuration should remain (see issues #2678, #3845, and #4244).
+ // configuration should remain (see issues #3845, and #4244).
foreach (string file in firstBackupFiles)
{
Assert.IsTrue(File.Exists(file));
}
+
+ // Configure and run a second backup with a different prefix. This should run without error.
+ secondOptions["prefix"] = new Options(firstOptions).Prefix + "2";
+ using (Controller c = new Controller("file://" + this.TARGETFOLDER, secondOptions, null))
+ {
+ IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER});
+ Assert.AreEqual(0, backupResults.Errors.Count());
+ Assert.AreEqual(0, backupResults.Warnings.Count());
+ }
+
+ // Even without a local database, we should be able to safely remove backend files from
+ // the second backup due to the prefix.
+ File.Delete(secondOptions["dbpath"]);
+ using (Controller c = new Controller("file://" + this.TARGETFOLDER, secondOptions, null))
+ {
+ IListRemoteResults listResults = c.DeleteAllRemoteFiles();
+ Assert.AreEqual(0, listResults.Errors.Count());
+ Assert.AreEqual(0, listResults.Warnings.Count());
+ }
+
+ // After we delete backend files from the second backup configuration, those from the first
+ // configuration should remain (see issue #2678).
+ foreach (string file in firstBackupFiles)
+ {
+ Assert.IsTrue(File.Exists(file));
+ }
+
+ // The first backup configuration should still run normally.
+ using (Controller c = new Controller("file://" + this.TARGETFOLDER, firstOptions, null))
+ {
+ IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER});
+ Assert.AreEqual(0, backupResults.Errors.Count());
+ Assert.AreEqual(0, backupResults.Warnings.Count());
+ }
}
}
} \ No newline at end of file