Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lightning: support both gs and gcs in url #30254

Merged
merged 7 commits into from
Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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