From e204f896850dfffdd4a5820d0d6c89f68d16f15c Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 10 Nov 2020 16:45:47 +0000 Subject: [PATCH] servetest: add -sub-run flag for running a subset of the backend tests Use like this (eg in cmd/serve/sftp) go test -v -run TestSftp/Normal -sub-run "TestIntegration/FsMkdir/FsPutFiles/FsDirMove" --- cmd/serve/servetest/servetest.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/serve/servetest/servetest.go b/cmd/serve/servetest/servetest.go index 40f23222b..f0f246335 100644 --- a/cmd/serve/servetest/servetest.go +++ b/cmd/serve/servetest/servetest.go @@ -5,6 +5,7 @@ package servetest import ( "context" + "flag" "fmt" "os" "os/exec" @@ -20,6 +21,8 @@ import ( "github.com/stretchr/testify/require" ) +var subRun = flag.String("sub-run", "", "pass this to the -run command of the backend tests") + // StartFn describes the callback which should start the server with // the Fs passed in. // It should return a config for the backend used to connect to the @@ -74,6 +77,9 @@ func run(t *testing.T, name string, start StartFn, useProxy bool) { args = append(args, "-verbose") } remoteName := name + "test:" + if *subRun != "" { + args = append(args, "-run", *subRun) + } args = append(args, "-remote", remoteName) args = append(args, "-list-retries", fmt.Sprint(*fstest.ListRetries)) cmd := exec.Command("go", args...)