s3api_bucket_test.go 679 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package s3bucket
  2. import (
  3. "github.com/stretchr/testify/assert"
  4. "testing"
  5. )
  6. func Test_verifyBucketName(t *testing.T) {
  7. invalidS3BucketNames := []string{
  8. "A9325325b",
  9. "123.12.153.10",
  10. "abc214..2",
  11. "d",
  12. ".ewfs3253543",
  13. "grehtrry-",
  14. "----------",
  15. "x@fdsgr032",
  16. }
  17. for _, invalidName := range invalidS3BucketNames {
  18. err := VerifyS3BucketName(invalidName)
  19. assert.NotNil(t, err)
  20. }
  21. validS3BucketName := []string{
  22. "a9325325b",
  23. "999.12.153.10",
  24. "abc214.2",
  25. "3d3d3d",
  26. "ewfs3253543",
  27. "grehtrry-a",
  28. "0----------0",
  29. "xafdsgr032",
  30. }
  31. for _, invalidName := range validS3BucketName {
  32. err := VerifyS3BucketName(invalidName)
  33. assert.Nil(t, err)
  34. }
  35. }