package utils

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

var exist interface{}

func TestRandomInstanceID(t *testing.T) {
	generatedID := make(map[string]interface{})
	for i := 0; i < 1024; i++ {
		id := RandomInstanceID()
		assert.Equal(t, 16, len(id))
		assert.False(t, id[0] >= '0' && id[0] <= '9', id, "must start with letter")
		_, found := generatedID[id]
		assert.False(t, found, "found the same id", id)
		generatedID[id] = exist
	}
}
