testing

package
v3.9.3 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package testing is the package that contains unit-test libraries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool added in v3.9.1

func Bool(b bool) *bool

Bool returns a pointer to a bool.

func EnsureCIDR

func EnsureCIDR(cidr string) *net.IPNet

EnsureCIDR parses/verify CIDR ip string and convert to net.IPNet

func Int added in v3.9.1

func Int(i int) *int

Int returns a pointer to an int

func NewFakeNetAttachDef

func NewFakeNetAttachDef(namespace, name, config string) *netv1.NetworkAttachmentDefinition

NewFakeNetAttachDef returns net-attach-def for testing

func NewFakeNetAttachDefAnnotation

func NewFakeNetAttachDefAnnotation(namespace, name, config string) *netv1.NetworkAttachmentDefinition

NewFakeNetAttachDefAnnotation returns net-attach-def with resource annotation

func NewFakeNetAttachDefFile

func NewFakeNetAttachDefFile(namespace, name, filePath, fileData string) *netv1.NetworkAttachmentDefinition

NewFakeNetAttachDefFile returns net-attach-def for testing with conf file

func NewFakePod

func NewFakePod(name string, netAnnotation string, defaultNetAnnotation string) *v1.Pod

NewFakePod creates fake Pod object

Types

type Result

type Result struct {
	CNIVersion string             `json:"cniVersion,omitempty"`
	IP4        *types020.IPConfig `json:"ip4,omitempty"`
	IP6        *types020.IPConfig `json:"ip6,omitempty"`
	DNS        types.DNS          `json:"dns,omitempty"`
}

Result is stub Result for testing

func (*Result) GetAsVersion

func (r *Result) GetAsVersion(version string) (types.Result, error)

GetAsVersion returns a Result object given a version

func (*Result) Print

func (r *Result) Print() error

Print prints a Result's information to std out

func (*Result) PrintTo

func (r *Result) PrintTo(writer io.Writer) error

PrintTo prints a Result's information to the provided writer

func (*Result) String

func (r *Result) String() string

String returns a formatted string in the form of "[IP4: $1,][ IP6: $2,] DNS: $3" where $1 represents the receiver's IPv4, $2 represents the receiver's IPv6 and $3 the receiver's DNS. If $1 or $2 are nil, they won't be present in the returned string.

func (*Result) Version

func (r *Result) Version() string

Version returns current CNIVersion of the given Result

Jump to

Keyboard shortcuts

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