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-12-01 05:38:18 +0300
committerKenneth Hsu <kennethhsu@gmail.com>2020-12-01 06:56:08 +0300
commit780f53b89a08ff10f940c4266741e7eb2c890543 (patch)
tree365e28090581e199dbec671d5764c5effc111df5 /Duplicati/UnitTest
parent9952babf0bf52c0fa88894b156329bd1441abe72 (diff)
Add test for purging broken files with dry-run.
This concerns #4379.
Diffstat (limited to 'Duplicati/UnitTest')
-rw-r--r--Duplicati/UnitTest/PurgeTesting.cs19
1 files changed, 18 insertions, 1 deletions
diff --git a/Duplicati/UnitTest/PurgeTesting.cs b/Duplicati/UnitTest/PurgeTesting.cs
index 69dea326f..d35d3dc1e 100644
--- a/Duplicati/UnitTest/PurgeTesting.cs
+++ b/Duplicati/UnitTest/PurgeTesting.cs
@@ -20,6 +20,7 @@ using System.IO;
using System.Linq;
using Duplicati.Library.Common.IO;
using Duplicati.Library.Interface;
+using Duplicati.Library.Main;
using Duplicati.Library.Utility;
using NUnit.Framework;
@@ -260,6 +261,15 @@ namespace Duplicati.UnitTest
Assert.AreEqual(affectedfiles[i], files);
}
+ // A dry-run should run without exceptions (see issue #4379).
+ Dictionary<string, string> dryRunOptions = new Dictionary<string, string>(testopts) {["dry-run"] = "true"};
+ using (Controller c = new Controller("file://" + this.TARGETFOLDER, dryRunOptions, null))
+ {
+ IPurgeBrokenFilesResults purgeResults = c.PurgeBrokenFiles(null);
+ Assert.AreEqual(0, purgeResults.Errors.Count());
+ Assert.AreEqual(0, purgeResults.Warnings.Count());
+ }
+
using (var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts, null))
{
var brk = c.PurgeBrokenFiles(null);
@@ -274,7 +284,14 @@ namespace Duplicati.UnitTest
Assert.AreEqual(3, modFilesets);
}
- }
+ // A subsequent backup should be successful.
+ using (Controller c = new Controller("file://" + this.TARGETFOLDER, testopts, null))
+ {
+ IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER});
+ Assert.AreEqual(0, backupResults.Errors.Count());
+ Assert.AreEqual(0, backupResults.Warnings.Count());
+ }
+ }
}
}