Documentation
¶
Index ¶
Constants ¶
const (
DefaultGracePeriod = time.Second * 15
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestSession ¶
type TestSession struct { SessionId string WorkerAddr string Transport *http.Transport SessionAuthzData *targetspb.SessionAuthorizationData // contains filtered or unexported fields }
TestSession represents an authorized session.
func NewTestSession ¶
func NewTestSession( ctx context.Context, t *testing.T, tcl *targets.Client, targetId string, ) *TestSession
NewTestSession authorizes a session and creates all of the data necessary to initialize.
func (*TestSession) Connect ¶
func (s *TestSession) Connect( ctx context.Context, t *testing.T, ) *TestSessionConnection
Connect returns a TestSessionConnection for a TestSession. Check the unexported connect method for the lower-level details.
func (*TestSession) ExpectConnectionStateOnController ¶
func (s *TestSession) ExpectConnectionStateOnController( ctx context.Context, t *testing.T, connectionRepoFn common.ConnectionRepoFactory, expectState session.ConnectionStatus, )
ExpectConnectionStateOnController waits until all connections in a session have transitioned to a particular state on the controller.
func (*TestSession) ExpectConnectionStateOnWorker ¶
func (s *TestSession) ExpectConnectionStateOnWorker( ctx context.Context, t *testing.T, tw *worker.TestWorker, expectState session.ConnectionStatus, )
ExpectConnectionStateOnWorker waits until all connections in a session have transitioned to a particular state on the worker.
type TestSessionConnection ¶
type TestSessionConnection struct {
// contains filtered or unexported fields
}
TestSessionConnection abstracts a connected session.
func (*TestSessionConnection) TestSendRecvAll ¶
func (c *TestSessionConnection) TestSendRecvAll(t *testing.T)
TestSendRecvAll asserts that we were able to send/recv all pings over the test connection.
func (*TestSessionConnection) TestSendRecvFail ¶
func (c *TestSessionConnection) TestSendRecvFail(t *testing.T)
TestSendRecvFail asserts that we were able to send/recv all pings over the test connection.
type TestTcpServer ¶
type TestTcpServer struct {
// contains filtered or unexported fields
}
TestTcpServer defines a simple testing TCP server. Data is simply copied from its input to its output.
func NewTestTcpServer ¶
func NewTestTcpServer(t *testing.T) *TestTcpServer
NewTestTcpServer creates a TestTcpServer and runs it.
func (*TestTcpServer) Close ¶
func (ts *TestTcpServer) Close()
Close closes the listener and all active connections.
func (*TestTcpServer) Port ¶
func (ts *TestTcpServer) Port() uint32
Port returns the port number for the test server listener.