You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boundary/internal/securerandom/random_test.go

28 lines
482 B

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: Apache-2.0
package securerandom
import (
"testing"
)
func TestGetSecureReader(t *testing.T) {
sr := getSecureReader()
if sr == nil || sr.Reader == nil {
t.Fatal("NewSecureRandom returned nil")
}
buf := make([]byte, 32)
n, err := sr.Reader.Read(buf)
if err != nil {
t.Fatalf("failed to read random bytes: %v", err)
}
if n != len(buf) {
t.Fatalf("expected to read %d bytes, got %d", len(buf), n)
}
}