Skip to content

Commit

Permalink
services/minio: change the way of creating bucket. (#1019)
Browse files Browse the repository at this point in the history
* services/minio: change the way of creating bucket

* services/minio: change the way of creating bucket

* services/minio: change the way of creating bucket

* services/minio: change the way of creating bucket
  • Loading branch information
Joey2132 authored Nov 10, 2021
1 parent 732adf1 commit d633439
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 29 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/services-test-minio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup test bucket
env:
AWS_ACCESS_KEY_ID: "minioadmin"
AWS_SECRET_ACCESS_KEY: "minioadmin"
AWS_EC2_METADATA_DISABLED: "true"
run: aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test

- name: Test
env:
STORAGE_MINIO_INTEGRATION_TEST: "on"
STORAGE_MINIO_CREDENTIAL: "hmac:minioadmin:minioadmin"
STORAGE_MINIO_NAME: "test-bucket"
STORAGE_MINIO_NAME: "test"
STORAGE_MINIO_ENDPOINT: "http:127.0.0.1:9000"
working-directory: services/minio
run: make integration_test
29 changes: 1 addition & 28 deletions services/minio/tests/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,14 @@ import (
func setupTest(t *testing.T) types.Storager {
t.Log("Setup test for minio")

srv, err := minio.NewServicer(
ps.WithCredential(os.Getenv("STORAGE_MINIO_CREDENTIAL")),
ps.WithEndpoint(os.Getenv("STORAGE_MINIO_ENDPOINT")),
)
if err != nil {
t.Errorf("new servicer: %v", err)
}

bucketName := os.Getenv("STORAGE_MINIO_NAME")

_, err = srv.Create(bucketName)
if err != nil {
t.Errorf("create storager: %v", err)
}

store, err := minio.NewStorager(
ps.WithCredential(os.Getenv("STORAGE_MINIO_CREDENTIAL")),
ps.WithEndpoint(os.Getenv("STORAGE_MINIO_ENDPOINT")),
ps.WithName(bucketName),
ps.WithName(os.Getenv("STORAGE_MINIO_NAME")),
ps.WithWorkDir("/"+uuid.New().String()),
)
if err != nil {
t.Errorf("new storager: %v", err)
}

t.Cleanup(func() {
err = store.Delete("")
if err != nil {
t.Errorf("cleanup: %v", err)
}

err = srv.Delete(bucketName)
if err != nil {
t.Errorf("cleanup: %v", err)
}
})
return store
}

0 comments on commit d633439

Please sign in to comment.