protondrive: make the tests honour RCLONE_CONFIG whichever tests run
Only fstest.Initialise, run by the integration test, applied RCLONE_CONFIG, so a filtered test run read the default rclone config, which may hold a real Proton remote. TestMain now applies it first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b5da26169a
commit
634a2423eb
1 file changed
+11
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/rclone/rclone/backend/protondrive/protontest"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/config"
|
||||
"github.com/rclone/rclone/fs/object"
|
||||
"github.com/rclone/rclone/fs/operations"
|
||||
fssync "github.com/rclone/rclone/fs/sync"
|
||||
@@ -31,7 +32,17 @@ const (
|
||||
|
||||
// TestMain runs the tests, then fails the run if any of them, through
|
||||
// any fake server, requested a removed share-scoped route.
|
||||
//
|
||||
// The config file is RCLONE_CONFIG's, as on rclone's command line,
|
||||
// whichever tests run: only fstest.Initialise would apply it, so the
|
||||
// default config, which may hold a real Proton remote, would be read.
|
||||
func TestMain(m *testing.M) {
|
||||
if path, ok := os.LookupEnv("RCLONE_CONFIG"); ok {
|
||||
if err := config.SetConfigPath(path); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "FAIL: RCLONE_CONFIG: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
code := m.Run()
|
||||
if legacy := protontest.LegacyRequests(); len(legacy) > 0 {
|
||||
fmt.Fprintf(os.Stderr, "FAIL: TestBudgetNoLegacyRoutes: removed share-scoped routes were requested: %v\n", legacy)
|
||||
|
||||
Reference in new issue
Block a user