diff --git a/pkg/types/types.go b/pkg/types/types.go index 9fecfd99e..2f703c186 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -14,13 +14,6 @@ type ClusterID uint32 var _ fmt.Stringer = (*ClusterID)(nil) -func NewClusterIDFromUint(u uint) (ClusterID, error) { - if u > math.MaxUint32 { - return 0, fmt.Errorf("cluster id overflow %v", u) - } - return ClusterID(u), nil -} - func ParseClusterID(s string) (ClusterID, error) { id, err := strconv.ParseUint(s, 10, 32) return ClusterID(id), err diff --git a/pkg/types/types_test.go b/pkg/types/types_test.go index c33d16768..0d1842db9 100644 --- a/pkg/types/types_test.go +++ b/pkg/types/types_test.go @@ -2,8 +2,6 @@ package types import ( "fmt" - "math" - "math/rand" "strings" "testing" @@ -16,23 +14,6 @@ func TestMain(m *testing.M) { goleak.VerifyTestMain(m) } -func TestClusterID(t *testing.T) { - Convey("ClusterID", t, func() { - Convey("Too large number", func() { // 64bit processor - var number uint = math.MaxUint32 + 1 - _, err := NewClusterIDFromUint(number) - So(err, ShouldNotBeNil) - }) - - Convey("Valid number", func() { - for i := 0; i < 10000; i++ { - _, err := NewClusterIDFromUint(uint(rand.Uint32())) - So(err, ShouldBeNil) - } - }) - }) -} - func TestTypesStorageNodeID(t *testing.T) { assert.True(t, StorageNodeID(-1).Invalid()) assert.True(t, StorageNodeID(0).Invalid())