|
@@ -38,7 +38,7 @@ func TestRequestSimple(t *testing.T) {
|
|
|
// the expected test file.
|
|
|
done := make(chan struct{})
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
select {
|
|
|
case <-done:
|
|
|
t.Error("More than one index update sent")
|
|
@@ -80,7 +80,7 @@ func TestSymlinkTraversalRead(t *testing.T) {
|
|
|
// the expected test file.
|
|
|
done := make(chan struct{})
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
select {
|
|
|
case <-done:
|
|
|
t.Error("More than one index update sent")
|
|
@@ -125,7 +125,7 @@ func TestSymlinkTraversalWrite(t *testing.T) {
|
|
|
badReq := make(chan string, 1)
|
|
|
badIdx := make(chan string, 1)
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
for _, f := range fs {
|
|
|
if f.Name == "symlink" {
|
|
|
done <- struct{}{}
|
|
@@ -183,7 +183,7 @@ func TestRequestCreateTmpSymlink(t *testing.T) {
|
|
|
goodIdx := make(chan struct{})
|
|
|
name := fs.TempName("testlink")
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
for _, f := range fs {
|
|
|
if f.Name == name {
|
|
|
if f.IsInvalid() {
|
|
@@ -240,7 +240,7 @@ func TestRequestVersioningSymlinkAttack(t *testing.T) {
|
|
|
// the expected test file.
|
|
|
idx := make(chan int)
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
idx <- len(fs)
|
|
|
}
|
|
|
fc.mut.Unlock()
|
|
@@ -339,7 +339,7 @@ func pullInvalidIgnored(t *testing.T, ft config.FolderType) {
|
|
|
|
|
|
done := make(chan struct{})
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
expected := map[string]struct{}{invIgn: {}, ign: {}, ignExisting: {}}
|
|
|
for _, f := range fs {
|
|
|
if _, ok := expected[f.Name]; !ok {
|
|
@@ -375,7 +375,7 @@ func pullInvalidIgnored(t *testing.T, ft config.FolderType) {
|
|
|
// The indexes will normally arrive in one update, but it is possible
|
|
|
// that they arrive in separate ones.
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
for _, f := range fs {
|
|
|
if _, ok := expected[f.Name]; !ok {
|
|
|
t.Errorf("Unexpected file %v was updated in index", f.Name)
|
|
@@ -434,7 +434,7 @@ func TestIssue4841(t *testing.T) {
|
|
|
|
|
|
received := make(chan []protocol.FileInfo)
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(_ string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, _ string, fs []protocol.FileInfo) {
|
|
|
received <- fs
|
|
|
}
|
|
|
fc.mut.Unlock()
|
|
@@ -483,7 +483,7 @@ func TestRescanIfHaveInvalidContent(t *testing.T) {
|
|
|
|
|
|
received := make(chan []protocol.FileInfo)
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(_ string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, _ string, fs []protocol.FileInfo) {
|
|
|
received <- fs
|
|
|
}
|
|
|
fc.mut.Unlock()
|
|
@@ -550,7 +550,7 @@ func TestParentDeletion(t *testing.T) {
|
|
|
fc.addFile(parent, 0777, protocol.FileInfoTypeDirectory, nil)
|
|
|
fc.addFile(child, 0777, protocol.FileInfoTypeDirectory, nil)
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
received <- fs
|
|
|
}
|
|
|
fc.mut.Unlock()
|
|
@@ -623,7 +623,7 @@ func TestRequestSymlinkWindows(t *testing.T) {
|
|
|
|
|
|
received := make(chan []protocol.FileInfo)
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
select {
|
|
|
case <-received:
|
|
|
t.Error("More than one index update sent")
|
|
@@ -693,7 +693,7 @@ func TestRequestRemoteRenameChanged(t *testing.T) {
|
|
|
|
|
|
received := make(chan []protocol.FileInfo)
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
select {
|
|
|
case <-received:
|
|
|
t.Error("More than one index update sent")
|
|
@@ -733,7 +733,7 @@ func TestRequestRemoteRenameChanged(t *testing.T) {
|
|
|
bFinalVersion := bIntermediateVersion.Copy().Update(fc.id.Short())
|
|
|
done := make(chan struct{})
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
select {
|
|
|
case <-done:
|
|
|
t.Error("Received more index updates than expected")
|
|
@@ -834,7 +834,7 @@ func TestRequestRemoteRenameConflict(t *testing.T) {
|
|
|
|
|
|
recv := make(chan int)
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
recv <- len(fs)
|
|
|
}
|
|
|
fc.mut.Unlock()
|
|
@@ -924,7 +924,7 @@ func TestRequestDeleteChanged(t *testing.T) {
|
|
|
|
|
|
done := make(chan struct{})
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
select {
|
|
|
case <-done:
|
|
|
t.Error("More than one index update sent")
|
|
@@ -947,7 +947,7 @@ func TestRequestDeleteChanged(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
select {
|
|
|
case <-done:
|
|
|
t.Error("More than one index update sent")
|
|
@@ -1069,7 +1069,7 @@ func TestIgnoreDeleteUnignore(t *testing.T) {
|
|
|
|
|
|
done := make(chan struct{})
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
basicCheck(fs)
|
|
|
close(done)
|
|
|
}
|
|
@@ -1088,7 +1088,7 @@ func TestIgnoreDeleteUnignore(t *testing.T) {
|
|
|
|
|
|
done = make(chan struct{})
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
basicCheck(fs)
|
|
|
f := fs[0]
|
|
|
if !f.IsInvalid() {
|
|
@@ -1110,7 +1110,7 @@ func TestIgnoreDeleteUnignore(t *testing.T) {
|
|
|
|
|
|
done = make(chan struct{})
|
|
|
fc.mut.Lock()
|
|
|
- fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
|
|
+ fc.indexFn = func(_ context.Context, folder string, fs []protocol.FileInfo) {
|
|
|
basicCheck(fs)
|
|
|
f := fs[0]
|
|
|
if f.IsInvalid() {
|