forked from TrueCloudLab/rclone
fstests: fixes the integration test errors running crypt over swift.
Skip tests involving errors creating or removing dirs on non root bucket based fs
This commit is contained in:
parent
63a2a935fc
commit
084fe38922
1 changed files with 23 additions and 2 deletions
|
@ -380,9 +380,25 @@ func Run(t *testing.T, opt *Opt) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Return true if f (or any of the things it wraps) is bucket
|
||||||
|
// based but not at the root.
|
||||||
|
isBucketBasedButNotRoot := func(f fs.Fs) bool {
|
||||||
|
for {
|
||||||
|
doUnWrap := f.Features().UnWrap
|
||||||
|
if doUnWrap == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
f = doUnWrap()
|
||||||
|
}
|
||||||
|
return f.Features().BucketBased && strings.Contains(strings.Trim(f.Root(), "/"), "/")
|
||||||
|
}
|
||||||
|
|
||||||
// TestFsRmdirNotFound tests deleting a non existent directory
|
// TestFsRmdirNotFound tests deleting a non existent directory
|
||||||
t.Run("TestFsRmdirNotFound", func(t *testing.T) {
|
t.Run("TestFsRmdirNotFound", func(t *testing.T) {
|
||||||
skipIfNotOk(t)
|
skipIfNotOk(t)
|
||||||
|
if isBucketBasedButNotRoot(remote) {
|
||||||
|
t.Skip("Skipping test as non root bucket based remote")
|
||||||
|
}
|
||||||
err := remote.Rmdir("")
|
err := remote.Rmdir("")
|
||||||
assert.Error(t, err, "Expecting error on Rmdir non existent")
|
assert.Error(t, err, "Expecting error on Rmdir non existent")
|
||||||
})
|
})
|
||||||
|
@ -938,6 +954,9 @@ func Run(t *testing.T, opt *Opt) {
|
||||||
// TestFsRmdirFull tests removing a non empty directory
|
// TestFsRmdirFull tests removing a non empty directory
|
||||||
t.Run("TestFsRmdirFull", func(t *testing.T) {
|
t.Run("TestFsRmdirFull", func(t *testing.T) {
|
||||||
skipIfNotOk(t)
|
skipIfNotOk(t)
|
||||||
|
if isBucketBasedButNotRoot(remote) {
|
||||||
|
t.Skip("Skipping test as non root bucket based remote")
|
||||||
|
}
|
||||||
err := remote.Rmdir("")
|
err := remote.Rmdir("")
|
||||||
require.Error(t, err, "Expecting error on RMdir on non empty remote")
|
require.Error(t, err, "Expecting error on RMdir on non empty remote")
|
||||||
})
|
})
|
||||||
|
@ -1382,8 +1401,10 @@ func Run(t *testing.T, opt *Opt) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
fstest.CheckListing(t, remote, []fstest.Item{})
|
fstest.CheckListing(t, remote, []fstest.Item{})
|
||||||
|
|
||||||
|
if !isBucketBasedButNotRoot(remote) {
|
||||||
err = operations.Purge(remote, "")
|
err = operations.Purge(remote, "")
|
||||||
assert.Error(t, err, "Expecting error after on second purge")
|
assert.Error(t, err, "Expecting error after on second purge")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// TestFinalise tidies up after the previous tests
|
// TestFinalise tidies up after the previous tests
|
||||||
|
|
Loading…
Reference in a new issue