mirror of
https://github.com/rclone/rclone.git
synced 2024-12-23 15:38:57 +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
|
// ExtraConfigItem describes a config item added on the fly while testing
|
||||||
type ExtraConfigItem struct{ Name, Key, Value string }
|
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
|
// TestInit tests basic intitialisation
|
||||||
func TestInit(t *testing.T) {
|
func TestInit(t *testing.T) {
|
||||||
var err error
|
var err error
|
||||||
@ -79,15 +95,10 @@ func TestInit(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
isLocalRemote = true
|
isLocalRemote = true
|
||||||
}
|
}
|
||||||
subRemoteName, subRemoteLeaf, err = fstest.RandomRemoteName(RemoteName)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
remote, err = fs.NewFs(subRemoteName)
|
newFs(t)
|
||||||
if err == fs.ErrorNotFoundInConfigFile {
|
|
||||||
t.Logf("Didn't find %q in config file - skipping tests", RemoteName)
|
skipIfNotOk(t)
|
||||||
return
|
|
||||||
}
|
|
||||||
require.NoError(t, err, fmt.Sprintf("unexpected error: %v", err))
|
|
||||||
fstest.TestMkdir(t, remote)
|
fstest.TestMkdir(t, remote)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,6 +169,12 @@ func TestFsRmdirNotFound(t *testing.T) {
|
|||||||
// TestFsMkdir tests tests making a directory
|
// TestFsMkdir tests tests making a directory
|
||||||
func TestFsMkdir(t *testing.T) {
|
func TestFsMkdir(t *testing.T) {
|
||||||
skipIfNotOk(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)
|
||||||
fstest.TestMkdir(t, remote)
|
fstest.TestMkdir(t, remote)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user