link

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package link helps with creating transient type virtual network interfaces of various types for testing purposes. It leverages the Ginkgo testing framework and matching (erm, sic!) Gomega matchers.

The network interfaces created by this package are transient because they automatically get removed at the end of the a test (spec, block/group, suite, et cetera) using Ginkgo's DeferCleanup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureUp added in v1.1.0

func EnsureUp(link netlink.Link, within ...time.Duration)

EnsureUp brings the specified network interface up and waits for it to become operationally “UP”. The maximum wait duration can be optionally specified; it defaults to 2s.

func NewTransient

func NewTransient(link netlink.Link, prefix string) netlink.Link

NewTransient creates a transient network interface of the specified type (via the type of the link value passed in) and with a name that begins with the given prefix and a random string of 10 hex digits. The newly created link is additionally scheduled for deletion using Ginko's DeferCleanup.

The passed link description is deep-copied first and thus never modified. Only the returned link description correctly references the newly created network interface ("link").

The newly created transient link starts in down operational state. Use netlink.LinkSetUp to bring its operational state "up".

NewTransient remembers the network namespace the network interface was created in, so that it can correctly clean up the transient network interface later from one of Ginkgo's deferred cleanup handlers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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