lib/model: Improve remoteFolderState reporting (fixes #8266) (#8283)

This commit is contained in:
André Colomb
2022-04-22 08:42:20 +02:00
committed by GitHub
parent 623ec03dad
commit 1eda82b95f
8 changed files with 73 additions and 29 deletions
+5 -5
View File
@@ -3764,16 +3764,16 @@ func TestClusterConfigOnFolderUnpause(t *testing.T) {
func TestAddFolderCompletion(t *testing.T) {
// Empty folders are always 100% complete.
comp := newFolderCompletion(db.Counts{}, db.Counts{}, 0, true)
comp.add(newFolderCompletion(db.Counts{}, db.Counts{}, 0, false))
comp := newFolderCompletion(db.Counts{}, db.Counts{}, 0, remoteFolderValid)
comp.add(newFolderCompletion(db.Counts{}, db.Counts{}, 0, remoteFolderPaused))
if comp.CompletionPct != 100 {
t.Error(comp.CompletionPct)
}
// Completion is of the whole
comp = newFolderCompletion(db.Counts{Bytes: 100}, db.Counts{}, 0, true) // 100% complete
comp.add(newFolderCompletion(db.Counts{Bytes: 400}, db.Counts{Bytes: 50}, 0, true)) // 82.5% complete
if comp.CompletionPct != 90 { // 100 * (1 - 50/500)
comp = newFolderCompletion(db.Counts{Bytes: 100}, db.Counts{}, 0, remoteFolderValid) // 100% complete
comp.add(newFolderCompletion(db.Counts{Bytes: 400}, db.Counts{Bytes: 50}, 0, remoteFolderValid)) // 82.5% complete
if comp.CompletionPct != 90 { // 100 * (1 - 50/500)
t.Error(comp.CompletionPct)
}
}