Skip to content

Commit

Permalink
feat(ci): ci var minio s3ForcePathStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
sevennt committed Oct 23, 2024
1 parent 480447a commit 9e4d879
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
# AK_ID: ${{ secrets.COS_AK_ID }}
# AK_SECRET: ${{ secrets.COS_AK_SECRET }}
# BUCKET_SHARD: ${{ secrets.COS_BUCKET_SHARD }}
# S3_FORCE_PATH_STYLE: false
# run:
# go test -run=TestS3 -v -race $(go list ./... | grep -v /examples)
- name: test-minio
Expand All @@ -39,6 +40,7 @@ jobs:
AK_ID: ${{ secrets.MINIO_AK_ID }}
AK_SECRET: ${{ secrets.MINIO_AK_SECRET }}
BUCKET_SHARD: ${{ secrets.MINIO_BUCKET }}
S3_FORCE_PATH_STYLE: true
run: env && go test -run=TestS3 -v -race $(go list ./... | grep -v /examples)
# - name: test-obs
# env:
Expand All @@ -48,6 +50,7 @@ jobs:
# AK_ID: ${{ secrets.OBS_AK_ID }}
# AK_SECRET: ${{ secrets.OBS_AK_SECRET }}
# BUCKET_SHARD: ${{ secrets.OBS_BUCKET }}
# S3_FORCE_PATH_STYLE: false
# run: go test -run=TestS3 -v -race $(go list ./... | grep -v /examples)
# - name: test-oss
# env:
Expand All @@ -57,4 +60,5 @@ jobs:
# AK_ID: ${{ secrets.OSS_AK_ID }}
# AK_SECRET: ${{ secrets.OSS_AK_SECRET }}
# BUCKET_SHARD: ${{ secrets.OSS_BUCKET }}
# S3_FORCE_PATH_STYLE: false
# run: go test -run=TestOSS -v -race $(go list ./... | grep -v /examples)
6 changes: 4 additions & 2 deletions aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/BurntSushi/toml"
"github.com/gotomicro/ego/core/econf"
"github.com/spf13/cast"
"github.com/stretchr/testify/assert"
)

Expand All @@ -36,7 +37,7 @@ accessKeyID = "%s"
accessKeySecret = "%s"
endpoint = "%s"
bucket = "%s"
s3ForcePathStyle = false
s3ForcePathStyle = %t
region = "%s"
ssl = false
shards = [%s]
Expand All @@ -51,8 +52,9 @@ func init() {
}

func newS3Cmp(bucket string, shards string) *Component {
s3ForcePathStyle := cast.ToBool(os.Getenv("S3_FORCE_PATH_STYLE"))
newConfs := fmt.Sprintf(s3Confs, os.Getenv("AK_ID"), os.Getenv("AK_SECRET"), os.Getenv("ENDPOINT"),
bucket, os.Getenv("REGION"), shards)
bucket, s3ForcePathStyle, os.Getenv("REGION"), shards)
fmt.Printf("newConfs--------------->"+"%+v\n", newConfs)
if err := econf.LoadFromReader(strings.NewReader(newConfs), toml.Unmarshal); err != nil {
panic(err)
Expand Down

0 comments on commit 9e4d879

Please sign in to comment.