Add testlib.RandBytes() helper.
Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
parent
674cd4a88c
commit
6b801056b5
@ -311,11 +311,15 @@ func CreateTestFederationDomain(ctx context.Context, t *testing.T, issuer string
|
||||
return federationDomain
|
||||
}
|
||||
|
||||
func RandHex(t *testing.T, numBytes int) string {
|
||||
func RandBytes(t *testing.T, numBytes int) []byte {
|
||||
buf := make([]byte, numBytes)
|
||||
_, err := io.ReadFull(rand.Reader, buf)
|
||||
require.NoError(t, err)
|
||||
return hex.EncodeToString(buf)
|
||||
return buf
|
||||
}
|
||||
|
||||
func RandHex(t *testing.T, numBytes int) string {
|
||||
return hex.EncodeToString(RandBytes(t, numBytes))
|
||||
}
|
||||
|
||||
func CreateTestSecret(t *testing.T, namespace string, baseName string, secretType corev1.SecretType, stringData map[string]string) *corev1.Secret {
|
||||
|
Loading…
Reference in New Issue
Block a user