Documentation ¶
Index ¶
- Constants
- Variables
- func BuildNetTestContext(pods []*provider.Pod, aIPVersion netcommons.IPVersion, aType netcommons.IFType, ...) (netsUnderTest map[string]netcommons.NetTestContext)
- func RunNetworkingTests(netsUnderTest map[string]netcommons.NetTestContext, count int, ...) (report testhelper.FailureReasonOut, skip bool)
- type PingResults
Constants ¶
View Source
const ( // ConnectInvalidArgumentRegex is a regex which matches when an invalid IP address or hostname is provided as input. ConnectInvalidArgumentRegex = `(?m)connect: Invalid argument$` // SuccessfulOutputRegex matches a successfully run "ping" command. That does not mean that no errors or drops // occurred during the test. SuccessfulOutputRegex = `(?m)(\d+) packets transmitted, (\d+)( packets){0,1} received, (?:\+(\d+) errors)?.*$` )
Variables ¶
View Source
var TestPing = func(sourceContainerID *provider.Container, targetContainerIP netcommons.ContainerIP, count int) (results PingResults, err error) { interfaceFlag := fmt.Sprintf("-I %s", targetContainerIP.InterfaceName) if targetContainerIP.InterfaceName == "" { interfaceFlag = "" } command := fmt.Sprintf("ping %s -c %d %s", interfaceFlag, count, targetContainerIP.IP) stdout, stderr, err := crclient.ExecCommandContainerNSEnter(command, sourceContainerID) if err != nil || stderr != "" { results.outcome = testhelper.ERROR return results, fmt.Errorf("ping failed with stderr:%s err:%s", stderr, err) } results, err = parsePingResult(stdout, stderr) return results, err }
TestPing Initiates a ping test between a source container and network (1 ip) and a destination container and network (1 ip)
Functions ¶
func BuildNetTestContext ¶
func BuildNetTestContext(pods []*provider.Pod, aIPVersion netcommons.IPVersion, aType netcommons.IFType, logger *log.Logger) (netsUnderTest map[string]netcommons.NetTestContext)
func RunNetworkingTests ¶
func RunNetworkingTests( netsUnderTest map[string]netcommons.NetTestContext, count int, aIPVersion netcommons.IPVersion, logger *log.Logger) (report testhelper.FailureReasonOut, skip bool)
runNetworkingTests takes a map netcommons.NetTestContext, e.g. one context per network attachment and runs pings test with it. Returns a network name to a slice of bad target IPs map.
Types ¶
type PingResults ¶
type PingResults struct {
// contains filtered or unexported fields
}
func (PingResults) String ¶
func (results PingResults) String() string
Click to show internal directories.
Click to hide internal directories.