diff --git a/repo/content/content_manager.go b/repo/content/content_manager.go index 59adecfb1..0ba99caa6 100644 --- a/repo/content/content_manager.go +++ b/repo/content/content_manager.go @@ -598,10 +598,8 @@ func maybeParallelExecutor(parallel int, originalCallback IterateCallback) (Iter cleanup := func() error { once.Do(func() { - log.Infof("finishing parallel iteration") close(workch) wg.Wait() - log.Infof("finished parallel iteration") }) return lastWorkerError() } diff --git a/repo/content/content_manager_test.go b/repo/content/content_manager_test.go index 7519b8695..a8b55b1ba 100644 --- a/repo/content/content_manager_test.go +++ b/repo/content/content_manager_test.go @@ -636,6 +636,7 @@ func TestIterateContents(t *testing.T) { desc: "failure", options: IterateOptions{}, fail: someError, + want: map[ID]bool{}, }, { desc: "failure-parallel", @@ -643,6 +644,7 @@ func TestIterateContents(t *testing.T) { Parallel: 10, }, fail: someError, + want: map[ID]bool{}, }, { desc: "parallel, include deleted", @@ -685,20 +687,19 @@ func TestIterateContents(t *testing.T) { if tc.fail != nil { return tc.fail } + mu.Lock() got[ci.ID] = true mu.Unlock() return nil }) - if (err != nil) != (tc.fail != nil) { + if tc.fail != err { t.Errorf("error iterating: %v", err) } - if err == nil { - if !reflect.DeepEqual(got, tc.want) { - t.Errorf("invalid content IDs got: %v, want %v", got, tc.want) - } + if !reflect.DeepEqual(got, tc.want) { + t.Errorf("invalid content IDs got: %v, want %v", got, tc.want) } }) }