Auto unmount test should also generate data

This commit is contained in:
Carl Johnsen
2026-02-27 06:32:40 +01:00
parent 653acb71a0
commit d51b2aeac6
@@ -565,7 +565,7 @@ namespace Duplicati.UnitTest
[Test]
[Category("DiskImage")]
public void Test_AutoUnmountOption_RestoreWhileOnline()
public async Task Test_AutoUnmountOption_RestoreWhileOnline()
{
TestContext.Progress.WriteLine("Test: Auto Unmount Option - Restore While Disk Online");
@@ -574,6 +574,12 @@ namespace Duplicati.UnitTest
var sourcePartitions = _diskHelper.InitializeDisk(sourceDrivePath, PartitionTableType.GPT, [(FileSystemType.FAT32, 0)]);
TestContext.Progress.WriteLine($"Source disk image created at: {_sourceImagePath}");
// Generate some test data
await ToolTests.GenerateTestData(sourcePartitions.First(), 10, 5, 2, 1024);
_diskHelper.FlushDisk(sourceDrivePath);
_diskHelper.Unmount(sourceDrivePath);
TestContext.Progress.WriteLine($"Test data generated on source partition");
// Backup
var backupResults = RunBackup(sourceDrivePath);
TestUtils.AssertResults(backupResults);
@@ -636,6 +642,7 @@ namespace Duplicati.UnitTest
VerifyPartitionTableMatches(sourceDrivePath, restoreDrivePath);
// Verify data matches byte-for-byte
sourcePartitions = _diskHelper.Mount(sourceDrivePath, _sourceMountPath, readOnly: true);
var restorePartitions = _diskHelper.Mount(restoreDrivePath, _restoreMountPath, readOnly: true);
var sourcePartition = sourcePartitions.First();
var restorePartition = restorePartitions.First();