"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
fstest: fix PublicLink tests to send non zero expiry and work with s3
Nick Craig-Wood4b4ee7279643
diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.goindex be5bff060..5e2de4eca 100644--- a/fstest/fstests/fstests.go+++ b/fstest/fstests/fstests.go@@ -1466,38 +1466,40 @@ func Run(t *testing.T, opt *Opt) {t.Skip("FS has no PublicLinker interface")}+ expiry := fs.Duration(60 * time.Second)+// if object not found- link, err := doPublicLink(ctx, file1.Path+"_does_not_exist", fs.Duration(0), false)+ link, err := doPublicLink(ctx, file1.Path+"_does_not_exist", expiry, false)require.Error(t, err, "Expected to get error when file doesn't exist")require.Equal(t, "", link, "Expected link to be empty on error")// sharing file for the first time- link1, err := doPublicLink(ctx, file1.Path, fs.Duration(0), false)+ link1, err := doPublicLink(ctx, file1.Path, expiry, false)require.NoError(t, err)require.NotEqual(t, "", link1, "Link should not be empty")- link2, err := doPublicLink(ctx, file2.Path, fs.Duration(0), false)+ link2, err := doPublicLink(ctx, file2.Path, expiry, false)require.NoError(t, err)require.NotEqual(t, "", link2, "Link should not be empty")require.NotEqual(t, link1, link2, "Links to different files should differ")// sharing file for the 2nd time- link1, err = doPublicLink(ctx, file1.Path, fs.Duration(0), false)+ link1, err = doPublicLink(ctx, file1.Path, expiry, false)require.NoError(t, err)require.NotEqual(t, "", link1, "Link should not be empty")// sharing directory for the first timepath := path.Dir(file2.Path)- link3, err := doPublicLink(ctx, path, fs.Duration(0), false)- if err != nil && errors.Cause(err) == fs.ErrorCantShareDirectories {+ link3, err := doPublicLink(ctx, path, expiry, false)+ if err != nil && (errors.Cause(err) == fs.ErrorCantShareDirectories || errors.Cause(err) == fs.ErrorObjectNotFound) {t.Log("skipping directory tests as not supported on this backend")} else {require.NoError(t, err)require.NotEqual(t, "", link3, "Link should not be empty")// sharing directory for the second time- link3, err = doPublicLink(ctx, path, fs.Duration(0), false)+ link3, err = doPublicLink(ctx, path, expiry, false)require.NoError(t, err)require.NotEqual(t, "", link3, "Link should not be empty")@@ -1511,7 +1513,7 @@ func Run(t *testing.T, opt *Opt) {_, err = subRemote.Put(ctx, buf, obji)require.NoError(t, err)- link4, err := subRemote.Features().PublicLink(ctx, "", fs.Duration(0), false)+ link4, err := subRemote.Features().PublicLink(ctx, "", expiry, false)require.NoError(t, err, "Sharing root in a sub-remote should work")require.NotEqual(t, "", link4, "Link should not be empty")}