Skip to content

Commit

Permalink
Add test to verify that fileset file exists after repair.
Browse files Browse the repository at this point in the history
This test would have failed prior to the changes in revision 0cfce6b
("Include fileset file when repairing missing dlist file").

This concerns issue duplicati#3982.
  • Loading branch information
warwickmm committed Dec 30, 2019
1 parent d3f7522 commit 7494abe
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Duplicati/UnitTest/DisruptionTests.cs
Expand Up @@ -115,6 +115,29 @@ public async Task FilesetFiles()
Assert.AreEqual(2, backupTypes.Length);
Assert.AreEqual(BackupType.FULL_BACKUP, backupTypes[1]);
Assert.AreEqual(BackupType.PARTIAL_BACKUP, backupTypes[0]);

// Remove the dlist files.
foreach (string dlistFile in dlistFiles)
{
File.Delete(dlistFile);
}

// Run a repair and verify that the fileset file exists in the new dlist files.
using (Controller c = new Controller("file://" + this.TARGETFOLDER, options, null))
{
c.Repair();
List<IListResultFileset> filesets = c.List().Filesets.ToList();
Assert.AreEqual(2, filesets.Count);
Assert.AreEqual(BackupType.FULL_BACKUP, filesets.Single(x => x.Version == 1).IsFullBackup);
Assert.AreEqual(BackupType.PARTIAL_BACKUP, filesets.Single(x => x.Version == 0).IsFullBackup);

backupTypeMap = GetBackupTypesFromRemoteFiles(c, out _);
}

backupTypes = backupTypeMap.OrderByDescending(x => x.Key).Select(x => x.Value).ToArray();
Assert.AreEqual(2, backupTypes.Length);
Assert.AreEqual(BackupType.FULL_BACKUP, backupTypes[1]);
Assert.AreEqual(BackupType.PARTIAL_BACKUP, backupTypes[0]);
}

[Test]
Expand Down

0 comments on commit 7494abe

Please sign in to comment.