mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 09:04:52 +01:00
fstests: attempt to fix flaky serve s3 test
Sometimes (particularly on macOS amd64) the serve s3 test fails with TestIntegration/FsMkdir/FsPutError where it wasn't expecting to get an object but it did. This is likely caused by a race between the serve s3 goroutine deleting the half uploaded file and the fstests code looking for it to not exist. This fix treats it like any other eventual consistency problem and retries the check using the test framework.
This commit is contained in:
parent
6f515ded8f
commit
089c168fb9
@ -762,9 +762,15 @@ func Run(t *testing.T, opt *Opt) {
|
|||||||
// assert.Nil(t, obj) - FIXME some remotes return the object even on nil
|
// assert.Nil(t, obj) - FIXME some remotes return the object even on nil
|
||||||
assert.NotNil(t, err)
|
assert.NotNil(t, err)
|
||||||
|
|
||||||
obj, err := f.NewObject(ctx, file2.Path)
|
retry(t, "FsPutError: test object does not exist", func() error {
|
||||||
assert.Nil(t, obj)
|
obj, err := f.NewObject(ctx, file2.Path)
|
||||||
assert.Equal(t, fs.ErrorObjectNotFound, err)
|
if err == nil {
|
||||||
|
return fserrors.RetryErrorf("object is present")
|
||||||
|
}
|
||||||
|
assert.Nil(t, obj)
|
||||||
|
assert.Equal(t, fs.ErrorObjectNotFound, err)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("FsPutZeroLength", func(t *testing.T) {
|
t.Run("FsPutZeroLength", func(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user