Skip to content

Commit

Permalink
Add tests for concurrent dcopy
Browse files Browse the repository at this point in the history
  • Loading branch information
otiai10 committed Sep 3, 2023
1 parent 78d861c commit 4c9bb1f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,3 +475,17 @@ func (r *SleepyReader) Read(p []byte) (int, error) {
}
return n, e
}

func TestOptions_NumberOfWorkers(t *testing.T) {
opt := Options{NumberOfWorkers: 3}
err := Copy("test/data/case19", "test/data.copy/case19", opt)
Expect(t, err).ToBe(nil)
}

func TestOptions_PreferConcurrent(t *testing.T) {
opt := Options{NumberOfWorkers: 4, PreferConcurrent: func(sd, dd string) (bool, error) {
return strings.HasSuffix(sd, "concurrent"), nil
}}
err := Copy("test/data/case19", "test/data.copy/case19_preferconcurrent", opt)
Expect(t, err).ToBe(nil)
}
1 change: 1 addition & 0 deletions test/data/case19/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Concurrent case
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit 4c9bb1f

Please sign in to comment.