testutil

package
v0.0.0-...-4971756 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2024 License: Apache-2.0, MIT Imports: 7 Imported by: 2

Documentation

Overview

Package testutil provides helper functions for netstack unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustParse4

func MustParse4(addr string) tcpip.Address

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

func MustParse6(addr string) tcpip.Address

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(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

func MustParseSubnet4(subnet string) tcpip.Subnet

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL