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

Allow Fs tests to declare new config items

Nick Craig-Woodb4b4b6cb1cdc
diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.go
index f694359b1..eb167e7c1 100644
--- a/fstest/fstests/fstests.go
+++ b/fstest/fstests/fstests.go
@@ -31,7 +31,9 @@ var (
subRemoteLeaf = ""
// NilObject should be set to a nil Object from the Fs under test
NilObject fs.Object
- file1 = fstest.Item{
+ // ExtraConfig is for adding config to a remote
+ ExtraConfig = []ExtraConfigItem{}
+ file1 = fstest.Item{
ModTime: fstest.Time("2001-02-03T04:05:06.499999999Z"),
Path: "file name.txt",
}
@@ -45,6 +47,9 @@ var (
dumpBodies = flag.Bool("dump-bodies", false, "Dump HTTP headers and bodies - may contain sensitive info")
)
+// ExtraConfigItem describes a config item added on the fly while testing
+type ExtraConfigItem struct{ Name, Key, Value string }
+
const eventualConsistencyRetries = 10
func init() {
@@ -60,6 +65,10 @@ func TestInit(t *testing.T) {
// "RCLONE_CONFIG_PASS=hunter2" (or your password)
*fs.AskPassword = false
fs.LoadConfig()
+ // Set extra config if supplied
+ for _, item := range ExtraConfig {
+ fs.ConfigFile.SetValue(item.Name, item.Key, item.Value)
+ }
fs.Config.Verbose = *verbose
fs.Config.Quiet = !*verbose
fs.Config.DumpHeaders = *dumpHeaders