Added extra test for the simple a + b test
This commit is contained in:
@@ -14,12 +14,88 @@
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
[TestFixture]
|
||||
public class Issue1410 : BasicSetupHelper
|
||||
{
|
||||
[TestFixtureSetUp()]
|
||||
public override void PrepareSourceData()
|
||||
{
|
||||
base.PrepareSourceData();
|
||||
|
||||
Directory.CreateDirectory(DATAFOLDER);
|
||||
Directory.CreateDirectory(TARGETFOLDER);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RunCommands()
|
||||
{
|
||||
TestOptions["verbose"] = "true";
|
||||
|
||||
var data = new byte[1024 * 1024 * 10];
|
||||
File.WriteAllBytes(Path.Combine(DATAFOLDER, "a"), data);
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, TestOptions, null))
|
||||
c.Backup(new string[] { DATAFOLDER });
|
||||
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, TestOptions.Expand(new { version = 0 }), null))
|
||||
{
|
||||
var r = c.List("*");
|
||||
Console.WriteLine("In first backup:");
|
||||
Console.WriteLine(string.Join(Environment.NewLine, r.Files.Select(x => x.Path)));
|
||||
}
|
||||
|
||||
new Random().NextBytes(data);
|
||||
File.WriteAllBytes(Path.Combine(DATAFOLDER, "b"), data);
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, TestOptions, null))
|
||||
c.Backup(new string[] { DATAFOLDER });
|
||||
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, TestOptions.Expand(new { version = 0 }), null))
|
||||
{
|
||||
var r = c.List("*");
|
||||
Console.WriteLine("Newest before deleting:");
|
||||
Console.WriteLine(string.Join(Environment.NewLine, r.Files.Select(x => x.Path)));
|
||||
Assert.AreEqual(3, r.Files.Count());
|
||||
}
|
||||
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, TestOptions.Expand(new { version = 0, no_local_db = true }), null))
|
||||
{
|
||||
var r = c.List("*");
|
||||
Console.WriteLine("Newest without db:");
|
||||
Console.WriteLine(string.Join(Environment.NewLine, r.Files.Select(x => x.Path)));
|
||||
Assert.AreEqual(3, r.Files.Count());
|
||||
}
|
||||
|
||||
|
||||
File.Delete(DBFILE);
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, TestOptions, null))
|
||||
c.Repair();
|
||||
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, TestOptions, null))
|
||||
Assert.AreEqual(c.List().Filesets.Count(), 2);
|
||||
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, TestOptions.Expand(new { version = 1 }), null))
|
||||
{
|
||||
var r = c.List("*");
|
||||
Console.WriteLine("Oldest after delete:");
|
||||
Console.WriteLine(string.Join(Environment.NewLine, r.Files.Select(x => x.Path)));
|
||||
Assert.AreEqual(2, r.Files.Count());
|
||||
}
|
||||
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, TestOptions.Expand(new { version = 0 }), null))
|
||||
{
|
||||
var r = c.List("*");
|
||||
Console.WriteLine("Newest after delete:");
|
||||
Console.WriteLine(string.Join(Environment.NewLine, r.Files.Select(x => x.Path)));
|
||||
Assert.AreEqual(3, r.Files.Count());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user