diff --git a/go/config.go b/go/config.go index ddf7cba..42b822c 100644 --- a/go/config.go +++ b/go/config.go @@ -268,6 +268,9 @@ func (c *Config) GetUser() string { // GetOutputBucket is getter of OutputBucket. func (c *Config) GetOutputBucket() string { + if strings.HasPrefix(c.dsn.Path, "/") { + return c.dsn.Scheme + "://" + c.dsn.Host + c.dsn.Path + } return c.dsn.Scheme + "://" + c.dsn.Host + "/" + c.dsn.Path } diff --git a/go/config_test.go b/go/config_test.go index 5a5bd07..dda8759 100644 --- a/go/config_test.go +++ b/go/config_test.go @@ -57,6 +57,16 @@ func TestAthenaConfig(t *testing.T) { assert.Nil(t, err) } +func TestGetOutputBucket(t *testing.T) { + var s3bucket string = "s3://query-results-henry-wu-us-east-2/local/" + testConf := NewNoOpsConfig() + err := testConf.SetOutputBucket(s3bucket) + conf, _ := NewConfig(testConf.Stringify()) + assert.Nil(t, err) + assert.Equal(t, testConf.GetOutputBucket(), "s3://query-results-henry-wu-us-east-2/local/") + assert.Equal(t, conf.GetOutputBucket(), "s3://query-results-henry-wu-us-east-2/local/") +} + func TestAthenaConfigWrongS3Bucket(t *testing.T) { var s3bucket string = "file:///query-results-henry-wu-us-east-2/" testConf := NewNoOpsConfig()