Skip to content

Commit

Permalink
lightning: support both gs and gcs in url (#30254) (#31169)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Feb 17, 2022
1 parent f1189ae commit 5b77532
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion br/pkg/lightning/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const (
)

var (
supportedStorageTypes = []string{"file", "local", "s3", "noop", "gcs"}
supportedStorageTypes = []string{"file", "local", "s3", "noop", "gcs", "gs"}

DefaultFilter = []string{
"*.*",
Expand Down
27 changes: 27 additions & 0 deletions br/pkg/lightning/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,33 @@ func (s *configTestSuite) TestAdjustInvalidBackend(c *C) {
c.Assert(err, ErrorMatches, "invalid config: unsupported `tikv-importer\\.backend` \\(no_such_backend\\)")
}

func (s *configTestSuite) TestCheckAndAdjustFilePath(c *C) {
tmpDir := c.MkDir()
// use slashPath in url to be compatible with windows
slashPath := filepath.ToSlash(tmpDir)

cfg := config.NewConfig()
cases := []string{
tmpDir,
".",
"file://" + slashPath,
"local://" + slashPath,
"s3://bucket_name",
"s3://bucket_name/path/to/dir",
"gcs://bucketname/path/to/dir",
"gs://bucketname/path/to/dir",
"noop:///",
}

for _, testCase := range cases {
cfg.Mydumper.SourceDir = testCase

err := cfg.CheckAndAdjustFilePath()
c.Assert(err, IsNil)
}

}

func (s *configTestSuite) TestAdjustFileRoutePath(c *C) {
cfg := config.NewConfig()
assignMinimalLegalValue(cfg)
Expand Down

0 comments on commit 5b77532

Please sign in to comment.