github.com/jenkins-x/jx/v2@v2.1.155/pkg/cloud/gke/storage/long_term_storage_test.go (about)

     1  // +build unit
     2  
     3  package storage
     4  
     5  import (
     6  	"strings"
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/assert"
    10  )
    11  
    12  func TestCreateAValidBucketNameWithLongClusterNameAndDashAtCharacterSixty(t *testing.T) {
    13  	bucketName := createUniqueBucketNameForCluster("rrehhhhhhhhhhhhhhhhhhhhhhhhhj3j3k2kwkdkjdbiwabduwabduoawbdb-dbwdbwaoud")
    14  	assert.NotNil(t, bucketName, "it should always generate a name")
    15  	assert.False(t, strings.HasSuffix(bucketName, "-"), "the bucket can't end with a dash")
    16  }
    17  
    18  func TestCreateAValidBucketNameWithSmallClusterName(t *testing.T) {
    19  	bucketName := createUniqueBucketNameForCluster("cluster")
    20  	assert.NotNil(t, bucketName, "it should always generate a name")
    21  	assert.False(t, strings.HasSuffix(bucketName, "-"), "the bucket can't end with a dash")
    22  }