Documentation
¶
Overview ¶
Package testutil provides various methods which we commonly use when writing tests
Index ¶
Constants ¶
const ( // GeoIP2IPv4 contains the only IPv4 in the geoip2 test database // Location: Milton, Washington, US GeoIP2IPv4 = "216.160.83.56" // GeoIP2IPv6 contains the only IPv6 in the geoip2 test database // Finland, EU GeoIP2IPv6 = "2a02:d200::1" )
Variables ¶
This section is empty.
Functions ¶
func GeoIP2Reader ¶
func GeoIP2Reader() (*geoip2.Reader, error)
GeoIP2Reader returns a city database reader with only 1 ipv4 and 1 ipv6 address
func RandInt64 ¶
func RandInt64() int64
RandInt64 returns a random integer. greater than or equal to 0, and less than 1 million. It's not necessary to do any seeding to use this method
func RandStr ¶
func RandStr() string
RandStr returns a random alphanumeric string of arbitrary length. It's not necessary to do any seeding to use this method
func SignedCert ¶
SignedCert generates a PEM encoded certificate/key pair for the given domain. If parentCertPEM/parentKeyPEM are given the certificate will be signed by that parent, otherwise it will be self-signed. If domain is not given, the returned certificate will itself be a signing CA certificate
This function will panic if it receives invalid input or can't read from rand.Reader for some reason
Types ¶
type RoundTripper ¶
type RoundTripper map[string]RoundTripperResponse
RoundTripper is an instance of a RoundTripper that allows you to pass the responses ahead of time per domain
type RoundTripperResponse ¶
Response is a response for a specific domain