mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 21:39:19 +08:00
26 lines
594 B
Go
26 lines
594 B
Go
|
package tencent
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/minio/minio-go/v7"
|
||
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func Test_NewMinioClient(t *testing.T) {
|
||
|
t.Run("ak sk ok", func(t *testing.T) {
|
||
|
minioCli, err := NewMinioClient("xxx.cos.ap-beijing.myqcloud.com", &minio.Options{
|
||
|
Creds: credentials.NewStaticV2("ak", "sk", ""),
|
||
|
Secure: true,
|
||
|
})
|
||
|
assert.NoError(t, err)
|
||
|
assert.Equal(t, "https", minioCli.EndpointURL().Scheme)
|
||
|
})
|
||
|
|
||
|
t.Run("iam failed", func(t *testing.T) {
|
||
|
_, err := NewMinioClient("", nil)
|
||
|
assert.Error(t, err)
|
||
|
})
|
||
|
}
|