milvus/internal/storage/tencent/tencent_test.go
cai.zhang 6cf2f09b60
feat: Support tencent cloud object storage for milvus (#30163)
issue: #30162

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
2024-01-23 11:28:56 +08:00

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)
})
}