Skip to content

Commit f7968aa

Browse files
committed
fstest: fix parsing of commas in -remotes
Connection string remotes like "TestGoogleCloudStorage,directory_markers:" use commas. Before this change, these could not be passed with the -remotes flag, which expected commas to be used only as separators. After this change, CSV parsing is used so that commas will be properly recognized inside a terminal-escaped and quoted value, like: -remotes local,\"TestGoogleCloudStorage,directory_markers:\"
1 parent 2a587d2 commit f7968aa

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

fstest/test_all/test_all.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Make TesTrun have a []string of flags to try - that then makes it generic
1111
*/
1212

1313
import (
14+
"encoding/csv"
1415
"flag"
1516
"fmt"
1617
"math/rand"
@@ -79,7 +80,14 @@ func main() {
7980

8081
// Filter selection
8182
if *testRemotes != "" {
82-
conf.filterBackendsByRemotes(strings.Split(*testRemotes, ","))
83+
// CSV parse to support connection string remotes with commas like -remotes local,\"TestGoogleCloudStorage,directory_markers:\"
84+
r := csv.NewReader(strings.NewReader(*testRemotes))
85+
remotes, err := r.Read()
86+
if err != nil {
87+
fs.Fatalf(*testRemotes, "error CSV-parsing -remotes string: %v", err)
88+
}
89+
fs.Debugf(*testRemotes, "using remotes: %v", remotes)
90+
conf.filterBackendsByRemotes(remotes)
8391
}
8492
if *testBackends != "" {
8593
conf.filterBackendsByBackends(strings.Split(*testBackends, ","))

0 commit comments

Comments
 (0)