Documentation
¶
Overview ¶
Package testsupport holds small helpers shared by test files across packages. It is not itself a _test.go file (Go doesn't let those be imported), but nothing outside test code should import it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteCredFile ¶
WriteCredFile writes body (or def, if body is empty) to name inside dir at 0600, and returns the file's path. Extracted from four near-identical copies across the migration command test suites (execute, init, lagcheck, executetbm) that each wrote a credentials file into a manifest fixture.
Types ¶
type CutListener ¶
CutListener is a TCP listener for a test server that can reset every connection it has accepted at once, the way a cluster drops its clients in a connection storm. It keeps accepting new connections afterwards. Hand it to sarama.NewMockBrokerListener to put a mock broker behind it.
func NewCutListener ¶
func NewCutListener(t testing.TB) *CutListener
NewCutListener listens on a free loopback port.
func (*CutListener) Accept ¶
func (l *CutListener) Accept() (net.Conn, error)
Accept accepts a connection and remembers it for Cut.
func (*CutListener) Cut ¶
func (l *CutListener) Cut()
Cut closes every connection accepted so far with a TCP reset.