Documentation ¶
Index ¶
- Constants
- Variables
- func AverageCPUDeltas(ctx context.Context, sampleInterval time.Duration) (*cpu.TimesStat, error)
- func CreateFSImg(ctx context.Context, t *testing.T, fsType string, testFiles ...FSImgFile) string
- func GenerateStubContent(id string) (string, error)
- func IsStubDrive(r io.Reader) bool
- func ParseStubContent(r io.Reader) (string, error)
- func RequiresIsolation(t testing.TB)
- func RequiresRoot(t testing.TB)
- func WaitForPidToExit(ctx context.Context, queryInterval time.Duration, pid int32) error
- func WaitForProcessToExist(ctx context.Context, queryInterval time.Duration, ...) ([]*process.Process, error)
- type FSImgFile
- type LocalNetworkServices
- type MountInfo
Constants ¶
const ( // StdinPort represents vsock port to be used for stdin StdinPort = 11000 // StdoutPort represents vsock port to be used for stdout StdoutPort = 11001 // StderrPort represents vsock port to be used for stderr StderrPort = 11002 // DefaultBufferSize represents buffer size in bytes to used for IO between runtime and agent DefaultBufferSize = 1024 // FirecrackerSockName is the name of the Firecracker VMM API socket FirecrackerSockName = "firecracker.sock" // FirecrackerVSockName is the name of the Firecracker VSock unix path used for communication // between the runtime and the agent FirecrackerVSockName = "firecracker.vsock" // FirecrackerLogFifoName is the name of the Firecracker VMM log FIFO FirecrackerLogFifoName = "fc-logs.fifo" // FirecrackerMetricsFifoName is the name of the Firecracker VMM metrics FIFO FirecrackerMetricsFifoName = "fc-metrics.fifo" // ShimAddrFileName is the name of the file in which a shim's API address can be found, used by // containerd to reconnect after it restarts ShimAddrFileName = "address" // ShimLogFifoName is the name of the FIFO created by containerd for a shim to write its logs to ShimLogFifoName = "log" // OCIConfigName is the name of the OCI bundle's config field OCIConfigName = "config.json" // BundleRootfsName is the name of the bundle's directory for holding the container's rootfs BundleRootfsName = "rootfs" // VMIDEnvVarKey is the environment variable key used to provide a VMID to a shim process VMIDEnvVarKey = "FIRECRACKER_VM_ID" // FCSocketFDEnvKey is the environment variable key used to provide the FD of the fccontrol listening socket to a shim FCSocketFDEnvKey = "FCCONTROL_SOCKET_FD" // ShimBinaryName is the name of the runtime shim binary ShimBinaryName = "containerd-shim-aws-firecracker" )
Variables ¶
var MagicStubBytes = []byte{214, 244, 216, 245, 215, 177, 177, 177}
MagicStubBytes used to determine whether or not a drive is a stub drive
Functions ¶
func AverageCPUDeltas ¶
AverageCPUDeltas returns the average CPU cycles consumed per sampleInterval, as calculated between the time this function is invoked and the time the provided ctx is cancelled.
func CreateFSImg ¶
CreateFSImg will create a file containing a filesystem image of the provided type containing the provided files. It returns the path at which the image file can be found.
func GenerateStubContent ¶
GenerateStubContent will generate stub content using the magic stub bytes and a length encoded string
func IsStubDrive ¶
IsStubDrive will check to see if the io.Reader follows our stub drive format. In the event of an error, this will return false. This will only return true when the first n bytes read matches that of the magic stub bytes and where n is the length of magic bytes.
func ParseStubContent ¶
ParseStubContent will parse the contents of an io.Reader and return the given id that was encoded
func RequiresIsolation ¶
RequiresIsolation will ensure that tests that must be run in an isolated environment are being run with the explicit ENABLE_ISOLATED_TESTS env var. If the env var has not been set, the test will be skipped
func RequiresRoot ¶
RequiresRoot will ensure that tests that require root access are actually root. In addition, this will skip root tests if the DISABLE_ROOT_TESTS is set to true
func WaitForPidToExit ¶
WaitForPidToExit queries running processes every `queryInterval` duration, blocking until the provided pid is found to not exist or the context is canceled.
func WaitForProcessToExist ¶
func WaitForProcessToExist( ctx context.Context, queryInterval time.Duration, matcher func(context.Context, *process.Process) (bool, error), ) ([]*process.Process, error)
WaitForProcessToExist queries running processes every `queryInterval` duration, blocking until the provided matcher function returns true for at least one running process or the context is canceled. If a query returns multiple matching processes, all will be returned.
Types ¶
type FSImgFile ¶
FSImgFile represents a file intended to be place in a filesystem image (at the provided subpath with the provided contents)
type LocalNetworkServices ¶
type LocalNetworkServices interface { // DNSServerIP returns the IP address of the DNS server // (useful for seting resolv.conf) DNSServerIP() string // URL returns the full URL to use when querying the provided // subpath. i.e. if subpath is "foo/bar", this will return // something like "http://phony.domain.test/foo/bar" URL(subpath string) string // Serve will start the DNS and HTTP servers, blocking until // either of them shuts down. Serve(ctx context.Context) error }
LocalNetworkServices provides a way of running bare-bones DNS and HTTP servers bound to the ip of a created device, which enables testing VM networking without relying on an external network.
func NewLocalNetworkServices ¶
func NewLocalNetworkServices(webpages map[string]string) (LocalNetworkServices, error)
NewLocalNetworkServices returns an implementation of LocalNetworkServices where the DNS server will bind to the ip of a created device and serve a single mapping from "domain" to that ip. The HTTP server will serve a pages at paths defined in the keys of "webpages", with the content set in the values of that map.
type MountInfo ¶
MountInfo holds data parsed from a line of /proc/mounts
func ParseProcMountLines ¶
ParseProcMountLines converts the provided strings, presumed to be lines read from /proc/mounts into MountInfo objects holding the parsed data about each mount.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package bundle implements some helper functions for firecracker-containerd's interaction with bundle dirs, both inside the VM and outside on the host.
|
Package bundle implements some helper functions for firecracker-containerd's interaction with bundle dirs, both inside the VM and outside on the host. |
cmd
|
|
test-bridged-tap
This is a bare-bones CNI plugin (with only ADD actually implemented, other methods are no-ops) used to setup a network bridge w/ tap in order to compare performance of a bridge-based VM network w/ a TC-based approach, such as that created by the tc-redirect-tap plugin.
|
This is a bare-bones CNI plugin (with only ADD actually implemented, other methods are no-ops) used to setup a network bridge w/ tap in order to compare performance of a bridge-based VM network w/ a TC-based approach, such as that created by the tc-redirect-tap plugin. |