mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 15:17:25 +00:00
lib/model: Unflake TestPullInvalidIgnored (#5918)
This commit is contained in:
parent
05835ed81f
commit
8a06cf0973
@ -367,10 +367,8 @@ func pullInvalidIgnored(t *testing.T, ft config.FolderType) {
|
|||||||
expected := map[string]struct{}{ign: {}, ignExisting: {}}
|
expected := map[string]struct{}{ign: {}, ignExisting: {}}
|
||||||
// The indexes will normally arrive in one update, but it is possible
|
// The indexes will normally arrive in one update, but it is possible
|
||||||
// that they arrive in separate ones.
|
// that they arrive in separate ones.
|
||||||
secondIndex := false
|
|
||||||
fc.mut.Lock()
|
fc.mut.Lock()
|
||||||
fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
||||||
secondIndex = true
|
|
||||||
for _, f := range fs {
|
for _, f := range fs {
|
||||||
if _, ok := expected[f.Name]; !ok {
|
if _, ok := expected[f.Name]; !ok {
|
||||||
t.Errorf("Unexpected file %v was updated in index", f.Name)
|
t.Errorf("Unexpected file %v was updated in index", f.Name)
|
||||||
@ -396,8 +394,6 @@ func pullInvalidIgnored(t *testing.T, ft config.FolderType) {
|
|||||||
}
|
}
|
||||||
if len(expected) == 0 {
|
if len(expected) == 0 {
|
||||||
close(done)
|
close(done)
|
||||||
} else if secondIndex {
|
|
||||||
t.Error("Didn't receive index updates for all existing files, missing", expected)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make sure pulling doesn't interfere, as index updates are racy and
|
// Make sure pulling doesn't interfere, as index updates are racy and
|
||||||
@ -413,7 +409,7 @@ func pullInvalidIgnored(t *testing.T, ft config.FolderType) {
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(5 * time.Second):
|
case <-time.After(5 * time.Second):
|
||||||
t.Fatalf("timed out before index was received")
|
t.Fatal("timed out before receiving index updates for all existing files, missing", expected)
|
||||||
case <-done:
|
case <-done:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user