testutil
v1.85.0
google.golang.org/grpc/credentials/alts/internal/testutil
Documentation
pkg.go.dev ↗Package testutil include useful test utilities for the handshaker.
Functions
MakeFrame
func MakeFrame(pl string) []byte
MakeFrame creates a handshake frame.
NewTestConn
func NewTestConn(in *bytes.Buffer, out *bytes.Buffer) net.Conn
NewTestConn creates a new instance of testConn object.
NewTestConnWithReadLatency
func NewTestConnWithReadLatency(in *bytes.Buffer, out *bytes.Buffer, readLatency time.Duration) net.Conn
NewTestConnWithReadLatency creates a new instance of testConn object that pauses for readLatency before any call to Read() returns.
NewUnresponsiveTestConn
func NewUnresponsiveTestConn() net.Conn
NewUnresponsiveTestConn creates a new instance of unresponsiveTestConn object.
Types
FakeHandshaker
type FakeHandshaker struct {
altsgrpc.HandshakerServiceServer
// ExpectedBoundAccessToken is the expected bound access token in the ClientStart request.
ExpectedBoundAccessToken string
}
FakeHandshaker is a fake implementation of the ALTS handshaker service.
FakeHandshaker.DoHandshake
func (h *FakeHandshaker) DoHandshake(stream altsgrpc.HandshakerService_DoHandshakeServer) error
DoHandshake performs a fake ALTS handshake.
Stats
type Stats struct {
MaxConcurrentCalls int
// contains filtered or unexported fields
}
Stats is used to collect statistics about concurrent handshake calls.
Stats.Reset
func (s *Stats) Reset()
Reset resets the statistics.
Stats.Update
func (s *Stats) Update() func()
Update updates the statistics by adding one call.