vitess.io/vitess@v0.16.2/go/vt/vtorc/util/token_test.go (about) 1 package util 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/require" 7 8 "vitess.io/vitess/go/vt/log" 9 ) 10 11 func init() { 12 } 13 14 func TestNewToken(t *testing.T) { 15 token1 := NewToken() 16 17 require.NotEqual(t, token1.Hash, "") 18 require.Equal(t, len(token1.Hash), 64) 19 } 20 21 func TestNewTokenRandom(t *testing.T) { 22 log.Infof("test") 23 token1 := NewToken() 24 token2 := NewToken() 25 26 // The following test can fail once in a quadrazillion eons 27 require.NotEqual(t, token1.Hash, token2.Hash) 28 }