Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockUntilGatewayAcceptsConnections ¶
BlockUntilGatewayAcceptsConnections attempts to initiate a connection to the gateway on the given address. It will time out if that address doesn't respond in time.
Types ¶
type MockListener ¶
type MockListener struct { CloseCallCount int // contains filtered or unexported fields }
MockListener forwards almost all calls to the real listener. When asked about address, it will return the one pointing at the fake port.
This lets us make calls to set the gateway port to a specific port without actually occupying those ports on the real system (which would lead to flaky tests otherwise).
func (*MockListener) Addr ¶
func (m *MockListener) Addr() net.Addr
func (*MockListener) Close ¶
func (m *MockListener) Close() error
func (*MockListener) RealAddr ¶
func (m *MockListener) RealAddr() net.Addr
type MockTCPPortAllocator ¶
type MockTCPPortAllocator struct { PortsInUse []string CallCount int // contains filtered or unexported fields }
func (*MockTCPPortAllocator) Listen ¶
func (m *MockTCPPortAllocator) Listen(localAddress, localPort string) (net.Listener, error)
Listen accepts localPort as an argument but creates a listener on a random port. This lets us test code that attempt to set the port number to a specific value without risking that the actual port on the device running the tests is occupied.
Listen returns a mock listener which forwards all methods to the real listener on the random port but its Addr function returns the port that was given as an argument to Listen.
func (*MockTCPPortAllocator) RecentListener ¶
func (m *MockTCPPortAllocator) RecentListener() *MockListener