mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 15:17:25 +00:00
lib/model: Unflake TestRequestReceiveEncryptedLocalNoSend (#7167)
This commit is contained in:
parent
9a9b7002cd
commit
240ae0c14f
@ -1353,7 +1353,26 @@ func TestRequestReceiveEncryptedLocalNoSend(t *testing.T) {
|
||||
m := setupModel(w)
|
||||
defer cleanupModelAndRemoveDir(m, tfs.URI())
|
||||
|
||||
fc := &fakeConnection{id: device1, model: m}
|
||||
files := genFiles(2)
|
||||
files[1].LocalFlags = protocol.FlagLocalReceiveOnly
|
||||
m.fmut.RLock()
|
||||
fset := m.folderFiles[fcfg.ID]
|
||||
m.fmut.RUnlock()
|
||||
fset.Update(protocol.LocalDeviceID, files)
|
||||
|
||||
indexChan := make(chan []protocol.FileInfo, 1)
|
||||
done := make(chan struct{})
|
||||
defer close(done)
|
||||
fc := &fakeConnection{
|
||||
id: device1,
|
||||
model: m,
|
||||
indexFn: func(_ context.Context, _ string, fs []protocol.FileInfo) {
|
||||
select {
|
||||
case indexChan <- fs:
|
||||
case <-done:
|
||||
}
|
||||
},
|
||||
}
|
||||
m.AddConnection(fc, protocol.Hello{})
|
||||
m.ClusterConfig(device1, protocol.ClusterConfig{
|
||||
Folders: []protocol.Folder{
|
||||
@ -1370,25 +1389,6 @@ func TestRequestReceiveEncryptedLocalNoSend(t *testing.T) {
|
||||
},
|
||||
})
|
||||
|
||||
indexChan := make(chan []protocol.FileInfo, 1)
|
||||
done := make(chan struct{})
|
||||
defer close(done)
|
||||
fc.mut.Lock()
|
||||
fc.indexFn = func(_ context.Context, _ string, fs []protocol.FileInfo) {
|
||||
select {
|
||||
case indexChan <- fs:
|
||||
case <-done:
|
||||
}
|
||||
}
|
||||
fc.mut.Unlock()
|
||||
|
||||
files := genFiles(2)
|
||||
files[1].LocalFlags = protocol.FlagLocalReceiveOnly
|
||||
m.fmut.RLock()
|
||||
fset := m.folderFiles[fcfg.ID]
|
||||
m.fmut.RUnlock()
|
||||
fset.Update(protocol.LocalDeviceID, files)
|
||||
|
||||
select {
|
||||
case fs := <-indexChan:
|
||||
if len(fs) != 1 {
|
||||
|
Loading…
Reference in New Issue
Block a user