"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
test: Add context to mockfs.NewFs #3257 #4685
Nick Craig-Woodd69b96a94c6b
diff --git a/fs/cache/cache_test.go b/fs/cache/cache_test.goindex 72e6ee019..ca5128aa6 100644--- a/fs/cache/cache_test.go+++ b/fs/cache/cache_test.go@@ -23,9 +23,9 @@ func mockNewFs(t *testing.T) (func(), func(ctx context.Context, path string) (fscalled++switch path {case "mock:/":- return mockfs.NewFs("mock", "/"), nil+ return mockfs.NewFs(ctx, "mock", "/"), nilcase "mock:/file.txt", "mock:file.txt":- return mockfs.NewFs("mock", "/"), fs.ErrorIsFile+ return mockfs.NewFs(ctx, "mock", "/"), fs.ErrorIsFilecase "mock:/error":return nil, errSentinel}@@ -124,7 +124,7 @@ func TestPut(t *testing.T) {cleanup, create := mockNewFs(t)defer cleanup()- f := mockfs.NewFs("mock", "/alien")+ f := mockfs.NewFs(context.Background(), "mock", "/alien")assert.Equal(t, 0, c.Entries())@@ -155,7 +155,7 @@ func TestPin(t *testing.T) {defer cleanup()// Test pinning and unpinning non existent- f := mockfs.NewFs("mock", "/alien")+ f := mockfs.NewFs(context.Background(), "mock", "/alien")Pin(f)Unpin(f)diff --git a/fs/fingerprint_test.go b/fs/fingerprint_test.goindex cca35e97c..0a69ceddf 100644--- a/fs/fingerprint_test.go+++ b/fs/fingerprint_test.go@@ -14,7 +14,7 @@ import (func TestFingerprint(t *testing.T) {ctx := context.Background()- f := mockfs.NewFs("test", "root")+ f := mockfs.NewFs(ctx, "test", "root")f.SetHashes(hash.NewHashSet(hash.MD5))for i, test := range []struct {diff --git a/fs/operations/multithread_test.go b/fs/operations/multithread_test.goindex feb45fa6a..da54112ae 100644--- a/fs/operations/multithread_test.go+++ b/fs/operations/multithread_test.go@@ -17,9 +17,9 @@ import ()func TestDoMultiThreadCopy(t *testing.T) {- f := mockfs.NewFs("potato", "")+ f := mockfs.NewFs(context.Background(), "potato", "")src := mockobject.New("file.txt").WithContent([]byte(random.String(100)), mockobject.SeekModeNone)- srcFs := mockfs.NewFs("sausage", "")+ srcFs := mockfs.NewFs(context.Background(), "sausage", "")src.SetFs(srcFs)oldStreams := fs.Config.MultiThreadStreamsdiff --git a/fs/rc/cache_test.go b/fs/rc/cache_test.goindex 19d935d36..ca5a1cd8e 100644--- a/fs/rc/cache_test.go+++ b/fs/rc/cache_test.go@@ -11,7 +11,7 @@ import ()func mockNewFs(t *testing.T) func() {- f := mockfs.NewFs("mock", "mock")+ f := mockfs.NewFs(context.Background(), "mock", "mock")cache.Put("/", f)return func() {cache.Clear()diff --git a/fs/walk/walk_test.go b/fs/walk/walk_test.goindex e50e9478a..509797b0f 100644--- a/fs/walk/walk_test.go+++ b/fs/walk/walk_test.go@@ -709,7 +709,7 @@ func TestListR(t *testing.T) {mockobject.Object("dir/b"),mockobject.Object("dir/c"),}- f := mockfs.NewFs("mock", "/")+ f := mockfs.NewFs(context.Background(), "mock", "/")var got []stringclearCallback := func() {got = nildiff --git a/fstest/mockfs/mockfs.go b/fstest/mockfs/mockfs.goindex b036c57ce..fe73db5ca 100644--- a/fstest/mockfs/mockfs.go+++ b/fstest/mockfs/mockfs.go@@ -25,12 +25,12 @@ type Fs struct {var ErrNotImplemented = errors.New("not implemented")// NewFs returns a new mock Fs-func NewFs(name, root string) *Fs {+func NewFs(ctx context.Context, name, root string) *Fs {f := &Fs{name: name,root: root,}- f.features = (&fs.Features{}).Fill(f)+ f.features = (&fs.Features{}).Fill(ctx, f)return f}diff --git a/vfs/file_test.go b/vfs/file_test.goindex 0df50bfbd..5c226ad5b 100644--- a/vfs/file_test.go+++ b/vfs/file_test.go@@ -137,7 +137,7 @@ func TestFileOpenReadUnknownSize(t *testing.T) {assert.Equal(t, int64(-1), o.Size())// add it to a mock fs- f := mockfs.NewFs("test", "root")+ f := mockfs.NewFs(context.Background(), "test", "root")f.AddObject(o)testObj, err := f.NewObject(ctx, remote)require.NoError(t, err)