Remove fixed index files from output

This removes index files that were succesfully repaired from the output, so the now-missing files are not reported as failures.

This fixes #6336
This commit is contained in:
Kenneth Skovhede
2025-06-20 16:40:21 +02:00
parent 66b4d34af3
commit 6912d89b99
3 changed files with 14 additions and 0 deletions
@@ -373,6 +373,7 @@ namespace Duplicati.Library.Main.Operation
await backendManager.DeleteAsync(vol.Name, vol.Size, true, m_results.TaskControl.ProgressToken).ConfigureAwait(false);
await backendManager.WaitForEmptyAsync(repairdb, rtr.Transaction, m_results.TaskControl.ProgressToken).ConfigureAwait(false);
rtr.Commit("ReplaceFaultyIndexFileCommit");
m_results.RemoveResult(vol.Name);
}
}
catch (Exception ex)
+7
View File
@@ -877,6 +877,13 @@ namespace Duplicati.Library.Main
m_verifications.Add(res);
return res;
}
public void RemoveResult(string volume)
{
var item = m_verifications.FirstOrDefault(x => x.Key == volume);
if (item.Key == volume)
m_verifications.Remove(item);
}
}
internal class TestFilterResults : BasicResults, ITestFilterResults
+6
View File
@@ -137,10 +137,16 @@ namespace Duplicati.UnitTest
dont_replace_faulty_index_files = false,
});
var brokenIndexFileNames = brokenIndexFiles.Select(Path.GetFileName).ToHashSet();
using (var c = new Controller("file://" + TARGETFOLDER, repairopts, null))
{
var res = c.Test(short.MaxValue);
Assert.That(res.Warnings, Is.Not.Empty, "Expected warnings during test with broken index files");
var faultyResults = res.Verifications
.Where(x => x.Value.Any())
.Where(x => brokenIndexFileNames.Contains(x.Key)).ToList();
Assert.That(faultyResults, Is.Empty, "Expected no faulty index files reported after repair");
}
var indexFilesAfter = Directory.GetFiles(TARGETFOLDER, "*.dindex.zip", SearchOption.TopDirectoryOnly).ToHashSet();