lib/model: Locking in the request test

This commit is contained in:
Jakob Borg
2016-11-30 13:11:06 +01:00
parent 913a85c571
commit e4db86836b
2 changed files with 6 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ func TestRequestSimple(t *testing.T) {
// We listen for incoming index updates and trigger when we see one for
// the expected test file.
done := make(chan struct{})
fc.mut.Lock()
fc.indexFn = func(folder string, fs []protocol.FileInfo) {
for _, f := range fs {
if f.Name == "testfile" {
@@ -37,6 +38,7 @@ func TestRequestSimple(t *testing.T) {
}
}
}
fc.mut.Unlock()
// Send an update for the test file, wait for it to sync and be reported back.
contents := []byte("test file contents\n")