Documentation ¶
Overview ¶
Package testutil provides helper functions for netstack unit tests.
Index ¶
- func MustParse4(addr string) tcpip.Address
- func MustParse6(addr string) tcpip.Address
- func MustParseLink(addr string) tcpip.LinkAddress
- func MustParseSubnet4(subnet string) tcpip.Subnet
- func ValidateMultiCounterStats(multi reflect.Value, counters []reflect.Value, ...) error
- type ValidateMultiCounterStatsOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustParse4 ¶
MustParse4 parses an IPv4 string (e.g. "192.168.1.1") into a tcpip.Address. Passing an IPv4-mapped IPv6 address will yield only the 4 IPv4 bytes.
func MustParse6 ¶
MustParse6 parses an IPv6 string (e.g. "fe80::1") into a tcpip.Address. Passing an IPv4 address will yield an IPv4-mapped IPv6 address.
func MustParseLink ¶
func MustParseLink(addr string) tcpip.LinkAddress
MustParseLink parses a Link string into a tcpip.LinkAddress, panicking on error.
The string must be in the format aa:bb:cc:dd:ee:ff or aa-bb-cc-dd-ee-ff.
func MustParseSubnet4 ¶
MustParseSubnet4 parses an IPv4 subnet string (e.g. "192.168.1.0/24") into a tcpip.Subnet.
func ValidateMultiCounterStats ¶
func ValidateMultiCounterStats(multi reflect.Value, counters []reflect.Value, options ValidateMultiCounterStatsOptions) error
ValidateMultiCounterStats verifies that every counter stored in multi is correctly tracking its counterpart in the given counters.
Types ¶
type ValidateMultiCounterStatsOptions ¶
type ValidateMultiCounterStatsOptions struct { ExpectMultiCounterStat bool ExpectMultiIntegralStatCounterMap bool }
ValidateMultiCounterStatsOptions holds options used when validating multi counter stat structs.