Documentation ¶
Index ¶
- func GenerateNormalizedJSON(t *testing.T, jsonStr string) string
- func GetAvailableLocalAddress(t *testing.T) string
- func GetAvailablePort(t *testing.T) uint16
- func HostPortFromAddr(addr net.Addr) (host string, port int, err error)
- func TempSocketName(t *testing.T) string
- func WaitFor(t *testing.T, cond func() bool, errMsg ...interface{}) bool
- func WaitForPort(t *testing.T, port uint16) error
- type LimitedWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateNormalizedJSON ¶
GenerateNormalizedJSON generates a normalized JSON from the string given to the function. Useful to compare JSON contents that may have differences due to formatting. It returns nil in case of invalid JSON.
func GetAvailableLocalAddress ¶
GetAvailableLocalAddress finds an available local port and returns an endpoint describing it. The port is available for opening when this function returns provided that there is no race by some other code to grab the same port immediately.
func GetAvailablePort ¶
GetAvailablePort finds an available local port and returns it. The port is available for opening when this function returns provided that there is no race by some other code to grab the same port immediately.
func HostPortFromAddr ¶
HostPortFromAddr extracts host and port from a network address
func TempSocketName ¶
Types ¶
type LimitedWriter ¶
LimitedWriter is an io.Writer that will return an EOF error after MaxLen has been reached. If MaxLen is 0, Writes will always succeed.
func (*LimitedWriter) Close ¶
func (lw *LimitedWriter) Close() error