forked from TrueCloudLab/rclone
Attempt to make async buffer test more reliable
This commit is contained in:
parent
55755a8e5b
commit
ae9f8304fa
1 changed files with 4 additions and 1 deletions
|
@ -248,10 +248,12 @@ func testAsyncReaderClose(t *testing.T, writeto bool) {
|
||||||
var copyN int64
|
var copyN int64
|
||||||
var copyErr error
|
var copyErr error
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
started := make(chan struct{})
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
if true {
|
close(started)
|
||||||
|
if writeto {
|
||||||
// exercise the WriteTo path
|
// exercise the WriteTo path
|
||||||
copyN, copyErr = a.WriteTo(ioutil.Discard)
|
copyN, copyErr = a.WriteTo(ioutil.Discard)
|
||||||
} else {
|
} else {
|
||||||
|
@ -268,6 +270,7 @@ func testAsyncReaderClose(t *testing.T, writeto bool) {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// Do some copying
|
// Do some copying
|
||||||
|
<-started
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
// Abandon the copy
|
// Abandon the copy
|
||||||
a.Abandon()
|
a.Abandon()
|
||||||
|
|
Loading…
Reference in a new issue