package testutils
import "github.com/containernetworking/plugins/pkg/testutils"
Index ¶
- Variables
- func CmdAdd(cniNetns, cniContainerID, cniIfname string, conf []byte, f func() error) (types.Result, []byte, error)
- func CmdAddWithArgs(args *skel.CmdArgs, f func() error) (types.Result, []byte, error)
- func CmdCheck(cniNetns, cniContainerID, cniIfname string, f func() error) error
- func CmdCheckWithArgs(args *skel.CmdArgs, f func() error) error
- func CmdDel(cniNetns, cniContainerID, cniIfname string, f func() error) error
- func CmdDelWithArgs(args *skel.CmdArgs, f func() error) error
- func CmdStatus(f func() error) error
- func NewNS() (ns.NetNS, error)
- func Ping(saddr, daddr string, timeoutSec int) error
- func SpecVersionHasCHECK(ver string) bool
- func SpecVersionHasChaining(ver string) bool
- func SpecVersionHasIPVersion(ver string) bool
- func SpecVersionHasMultipleIPs(ver string) bool
- func SpecVersionHasSTATUS(ver string) bool
- func TmpResolvConf(dnsConf types.DNS) (string, error)
- func UnmountNS(ns ns.NetNS) error
- type BadReader
Variables ¶
var AllSpecVersions = [...]string{"0.1.0", "0.2.0", "0.3.0", "0.3.1", "0.4.0", "1.0.0", "1.1.0"}
AllSpecVersions contains all CNI spec version numbers
Functions ¶
func CmdAdd ¶
func CmdAdd(cniNetns, cniContainerID, cniIfname string, conf []byte, f func() error) (types.Result, []byte, error)
func CmdAddWithArgs ¶
func CmdCheck ¶
func CmdCheckWithArgs ¶
func CmdDel ¶
func CmdDelWithArgs ¶
func CmdStatus ¶
func NewNS ¶
Creates a new persistent (bind-mounted) network namespace and returns an object representing that namespace, without switching to it.
func Ping ¶
Ping shells out to the `ping` command. Returns nil if successful.
func SpecVersionHasCHECK ¶
SpecVersionHasCHECK returns true if the given CNI specification version supports the CHECK command
func SpecVersionHasChaining ¶
SpecVersionHasChaining returns true if the given CNI specification version supports plugin chaining
func SpecVersionHasIPVersion ¶
SpecVersionHasIPVersion returns true if the given CNI specification version includes the "version" field in the IP address elements
func SpecVersionHasMultipleIPs ¶
SpecVersionHasMultipleIPs returns true if the given CNI specification version supports more than one IP address of each family
func SpecVersionHasSTATUS ¶
SpecVersionHasSTATUS returns true if the given CNI specification version supports the STATUS command
func TmpResolvConf ¶
TmpResolvConf will create a temporary file and write the provided DNS settings to it in the resolv.conf format. It returns the path of the created temporary file or an error if any occurs while creating/writing the file. It is the caller's responsibility to remove the file.
func UnmountNS ¶
UnmountNS unmounts the NS held by the netns object
Types ¶
type BadReader ¶
type BadReader struct { Error error }
BadReader is an io.Reader which always errors
func (*BadReader) Close ¶
func (*BadReader) Read ¶
Source Files ¶
bad_reader.go cmd.go dns.go netns_linux.go ping.go testing.go
Directories ¶
Path | Synopsis |
---|---|
pkg/testutils/echo | |
pkg/testutils/echo/client | |
pkg/testutils/echo/server | Echosvr is a simple TCP echo server |
- Version
- v1.7.1 (latest)
- Published
- Apr 25, 2025
- Platform
- linux/amd64
- Imports
- 19 packages
- Last checked
- 3 weeks ago –
Tools for package owners.