seaweedfs/weed/s3api/s3bucket/s3api_bucket_test.go

38 lines
679 B
Go
Raw Normal View History

2023-02-08 06:45:20 +08:00
package s3bucket
import (
"github.com/stretchr/testify/assert"
"testing"
)
func Test_verifyBucketName(t *testing.T) {
invalidS3BucketNames := []string{
"A9325325b",
"123.12.153.10",
"abc214..2",
"d",
".ewfs3253543",
"grehtrry-",
"----------",
"x@fdsgr032",
}
for _, invalidName := range invalidS3BucketNames {
err := VerifyS3BucketName(invalidName)
assert.NotNil(t, err)
}
validS3BucketName := []string{
"a9325325b",
"999.12.153.10",
"abc214.2",
"3d3d3d",
"ewfs3253543",
"grehtrry-a",
"0----------0",
"xafdsgr032",
}
for _, invalidName := range validS3BucketName {
err := VerifyS3BucketName(invalidName)
assert.Nil(t, err)
}
}