Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

fstest: Fix TestPurge causing errors with subsequent tests on azure

Nick Craig-Woodf92beb4e14c8
diff --git a/fs/operations/operations_test.go b/fs/operations/operations_test.go
index 620175c91..95f4586e5 100644
--- a/fs/operations/operations_test.go
+++ b/fs/operations/operations_test.go
@@ -404,7 +404,7 @@ func TestRcat(t *testing.T) {
}
func TestPurge(t *testing.T) {
- r := fstest.NewRun(t)
+ r := fstest.NewRunIndividual(t) // make new container (azureblob has delayed mkdir after rmdir)
defer r.Finalise()
r.Mkdir(r.Fremote)
diff --git a/fstest/run.go b/fstest/run.go
index 23872e1b5..dda6d4570 100644
--- a/fstest/run.go
+++ b/fstest/run.go
@@ -121,16 +121,17 @@ func retry(t *testing.T, what string, f func() error) {
t.Logf("%s failed: %v", what, err)
}
-// NewRun initialise the remote and local for testing and returns a
-// run object. Call this from the tests.
+// newRunIndividual initialise the remote and local for testing and
+// returns a run object. Pass in true to make individual tests or
+// false to use the global one.
//
// r.Flocal is an empty local Fs
// r.Fremote is an empty remote Fs
//
// Finalise() will tidy them away when done.
-func NewRun(t *testing.T) *Run {
+func newRunIndividual(t *testing.T, individual bool) *Run {
var r *Run
- if *Individual {
+ if individual {
r = newRun()
} else {
// If not individual, use the global one with the clean method overridden
@@ -176,6 +177,22 @@ func NewRun(t *testing.T) *Run {
return r
}
+// NewRun initialise the remote and local for testing and returns a
+// run object. Call this from the tests.
+//
+// r.Flocal is an empty local Fs
+// r.Fremote is an empty remote Fs
+//
+// Finalise() will tidy them away when done.
+func NewRun(t *testing.T) *Run {
+ return newRunIndividual(t, *Individual)
+}
+
+// NewRunIndividual as per NewRun but makes an individual remote for this test
+func NewRunIndividual(t *testing.T) *Run {
+ return newRunIndividual(t, true)
+}
+
// RenameFile renames a file in local
func (r *Run) RenameFile(item Item, newpath string) Item {
oldFilepath := path.Join(r.LocalName, item.Path)