mirror of
https://github.com/rclone/rclone
synced 2024-11-10 08:08:35 +01:00
fstests: Use a different container after the Rmdir
Use a new directory here. This is for the container based remotes which take time to create and destroy a container (eg azure blob)
This commit is contained in:
parent
eff10bbc1d
commit
7ec24ad67a
@ -54,6 +54,22 @@ var (
|
||||
// ExtraConfigItem describes a config item added on the fly while testing
|
||||
type ExtraConfigItem struct{ Name, Key, Value string }
|
||||
|
||||
// Make the Fs we are testing with, initialising the global variables
|
||||
// subRemoteName - name of the remote after the TestRemote:
|
||||
// subRemoteLeaf - a subdirectory to use under that
|
||||
// remote - the result of fs.NewFs(TestRemote:subRemoteName)
|
||||
func newFs(t *testing.T) {
|
||||
var err error
|
||||
subRemoteName, subRemoteLeaf, err = fstest.RandomRemoteName(RemoteName)
|
||||
require.NoError(t, err)
|
||||
remote, err = fs.NewFs(subRemoteName)
|
||||
if err == fs.ErrorNotFoundInConfigFile {
|
||||
t.Logf("Didn't find %q in config file - skipping tests", RemoteName)
|
||||
return
|
||||
}
|
||||
require.NoError(t, err, fmt.Sprintf("unexpected error: %v", err))
|
||||
}
|
||||
|
||||
// TestInit tests basic intitialisation
|
||||
func TestInit(t *testing.T) {
|
||||
var err error
|
||||
@ -79,15 +95,10 @@ func TestInit(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
isLocalRemote = true
|
||||
}
|
||||
subRemoteName, subRemoteLeaf, err = fstest.RandomRemoteName(RemoteName)
|
||||
require.NoError(t, err)
|
||||
|
||||
remote, err = fs.NewFs(subRemoteName)
|
||||
if err == fs.ErrorNotFoundInConfigFile {
|
||||
t.Logf("Didn't find %q in config file - skipping tests", RemoteName)
|
||||
return
|
||||
}
|
||||
require.NoError(t, err, fmt.Sprintf("unexpected error: %v", err))
|
||||
newFs(t)
|
||||
|
||||
skipIfNotOk(t)
|
||||
fstest.TestMkdir(t, remote)
|
||||
}
|
||||
|
||||
@ -158,6 +169,12 @@ func TestFsRmdirNotFound(t *testing.T) {
|
||||
// TestFsMkdir tests tests making a directory
|
||||
func TestFsMkdir(t *testing.T) {
|
||||
skipIfNotOk(t)
|
||||
|
||||
// Use a new directory here. This is for the container based
|
||||
// remotes which take time to create and destroy a container
|
||||
// (eg azure blob)
|
||||
newFs(t)
|
||||
|
||||
fstest.TestMkdir(t, remote)
|
||||
fstest.TestMkdir(t, remote)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user