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-11-02 00:01:11 +0300
committerKenneth Hsu <kennethhsu@gmail.com>2020-11-02 01:19:09 +0300
commit6570cd954c50b8957b19322e8815494d68dc75e7 (patch)
treee7c382dabd2e071c05d3cacfebbb9510f0a0891f /Duplicati/UnitTest
parentca5aad9ccb5b59f6c1dc3bf7ae6c35713a9778d7 (diff)
Add test for specifying remote URL using run-script-before.
This concerns issue #3651.
Diffstat (limited to 'Duplicati/UnitTest')
-rw-r--r--Duplicati/UnitTest/RunScriptTests.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/Duplicati/UnitTest/RunScriptTests.cs b/Duplicati/UnitTest/RunScriptTests.cs
index c4117fd46..f6462b895 100644
--- a/Duplicati/UnitTest/RunScriptTests.cs
+++ b/Duplicati/UnitTest/RunScriptTests.cs
@@ -20,6 +20,7 @@ using System.IO;
using System.Linq;
using Duplicati.Library.Common;
using Duplicati.Library.Interface;
+using Duplicati.Library.Main;
using NUnit.Framework;
namespace Duplicati.UnitTest
@@ -147,6 +148,35 @@ namespace Duplicati.UnitTest
}
}
+ [Test]
+ [Category("Border")]
+ public void CustomRemoteURL()
+ {
+ string customTargetFolder = Path.Combine(this.TARGETFOLDER, "destination");
+ Directory.CreateDirectory(customTargetFolder);
+
+ List<string> customCommands = new List<string>
+ {
+ $"echo --remoteurl = \"{customTargetFolder}\""
+ };
+
+ Dictionary<string, string> options = this.TestOptions;
+ options["run-script-before"] = CreateScript(0, null, null, 0, customCommands);
+ using (Controller c = new Library.Main.Controller("file://" + this.TARGETFOLDER, options, null))
+ {
+ IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER});
+ Assert.AreEqual(0, backupResults.Errors.Count());
+ Assert.AreEqual(0, backupResults.Warnings.Count());
+ }
+
+ string[] targetEntries = Directory.EnumerateFileSystemEntries(this.TARGETFOLDER).ToArray();
+ Assert.AreEqual(1, targetEntries.Length);
+ Assert.AreEqual(customTargetFolder, targetEntries[0]);
+
+ // We expect a dblock, dlist, and dindex file.
+ IEnumerable<string> customTargetEntries = Directory.EnumerateFileSystemEntries(customTargetFolder);
+ Assert.AreEqual(3, customTargetEntries.Count());
+ }
private string CreateScript(int exitcode, string stderr = null, string stdout = null, int sleeptime = 0, List<string> customCommands = null)
{