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

config: fix test failure on local machine with a config file

Nick Craig-Wood8d878d0a5fe1
diff --git a/fs/config/rc_test.go b/fs/config/rc_test.go
index b21b8af50..682a8fe71 100644
--- a/fs/config/rc_test.go
+++ b/fs/config/rc_test.go
@@ -3,6 +3,7 @@ package config_test
import (
"context"
"os"
+ "path/filepath"
"testing"
_ "github.com/rclone/rclone/backend/local"
@@ -19,6 +20,12 @@ const testName = "configTestNameForRc"
func TestRc(t *testing.T) {
ctx := context.Background()
+ oldConfigFile := config.GetConfigPath()
+ defer func() {
+ require.NoError(t, config.SetConfigPath(oldConfigFile))
+ }()
+ // Set a temporary config file
+ require.NoError(t, config.SetConfigPath(filepath.Join(t.TempDir(), "rclone.conf")))
configfile.Install()
// Create the test remote
call := rc.Calls.Get("config/create")