Documentation
¶
Overview ¶
Package shimtest is a conformance test suite for containerd shim implementations. The tests are organized into Suites — RunSuite, ExecSuite, TransferSuite, UDSSuite, OOMSuite — each gated against one feature key. Callers construct a Config and call the suite's Run method (or Bench / Fuzz) from their own test functions:
func TestMyShim(t *testing.T) {
cfg := shimtest.Config{ShimBinary: "containerd-shim-myshim-v1"}
shimtest.NewRunSuite(cfg).Run(t)
shimtest.NewExecSuite(cfg).Run(t)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// ShimBinary is the name (resolved via PATH) or absolute path of
// the shim binary under test.
ShimBinary string
// FormatMounts, when true, provides the rootfs to the shim as
// formatted erofs/ext4 images plus a format/mkdir/overlay mount
// descriptor — appropriate for VM-based shims that mount the
// rootfs themselves. When false the rootfs is extracted (or
// overlay-mounted on the host) and provided pre-mounted.
FormatMounts bool
// Env is a set of environment variables propagated to processes
// spawned by the harness (the shim binary, runc, etc.). The local
// JSON-driven runner applies this via os.Setenv before any test
// runs; library callers can pre-populate the process environment
// directly and leave this empty.
Env map[string]string
// Debug enables verbose logging from the shim.
Debug bool
}
Config carries everything a suite needs to bring up a shim. Callers identify their shim and tune setup behavior via this struct; suites hold a copy and use it for every test they run.
Config has no Skip field — choosing which suites to run is the caller's concern (skip a feature by not constructing the corresponding suite).
type ExecSuite ¶
type ExecSuite struct {
// contains filtered or unexported fields
}
ExecSuite contains tests gated on the "exec" feature: running processes inside a container, stdio round-trip, the in-VM clock, exec exit-code propagation, and file-IO benchmarks driven via hashverify.
func NewExecSuite ¶
NewExecSuite constructs an ExecSuite from the given options.
type OOMSuite ¶
type OOMSuite struct {
// contains filtered or unexported fields
}
OOMSuite contains the OOM-killer test, gated on the "oom" feature (some shim configurations don't expose memory cgroup controls or can't reliably trigger the kernel OOM killer).
func NewOOMSuite ¶
NewOOMSuite constructs an OOMSuite from the given options.
type RunSuite ¶
type RunSuite struct {
// contains filtered or unexported fields
}
RunSuite contains the always-run conformance tests: full container lifecycle, init exit-code propagation, output-then-exit, and event-stream verification. None of these tests are gated by a feature key — every shim should pass them.
func NewRunSuite ¶
NewRunSuite constructs a RunSuite from the given options.
type StressOptions ¶
type StressOptions struct {
// Transfer enables the bidirectional transfer-service stress
// test. The shim under test must implement the transfer service.
Transfer bool
}
StressOptions tunes which subtests StressSuite.Run executes.
type StressSuite ¶
type StressSuite struct {
// contains filtered or unexported fields
}
StressSuite contains long-running stress tests that exercise the shim under sustained load. Each subtest runs for a configurable duration (bounded by t.Deadline() - stressSoakBuffer); the whole suite is skipped under -short.
The suite verifies, on completion, that no shim processes leaked and (where applicable) that long-running shims didn't grow memory unboundedly.
func NewStressSuite ¶
func NewStressSuite(cfg Config, options StressOptions) *StressSuite
NewStressSuite constructs a StressSuite from cfg and options.
func (*StressSuite) Run ¶
func (s *StressSuite) Run(t *testing.T)
Run runs every configured stress test as a subtest of t. Skipped under -short. Registers a leak check that fires after all subtests (and their cleanups) complete.
type TransferSuite ¶
type TransferSuite struct {
// contains filtered or unexported fields
}
TransferSuite contains tests gated on the "transfer" feature: the transfer service's copy-in/out operations, the bidirectional-stream stress test, and a Fuzz target that callers can wire into a top-level FuzzXxx in their own _test.go.
func NewTransferSuite ¶
func NewTransferSuite(cfg Config) *TransferSuite
NewTransferSuite constructs a TransferSuite from the given options.
func (*TransferSuite) Fuzz ¶
func (s *TransferSuite) Fuzz(f *testing.F)
Fuzz exposes the missing-file fuzz body for use by a top-level FuzzXxx in any package. The caller's FuzzTransferMissing should look like:
func FuzzTransferMissing(f *testing.F) {
shimtest.NewTransferSuite(opts).Fuzz(f)
}
Each fuzz iteration synthesizes a path under a never-created base directory and asserts the transfer service returns an application-level error (not a timeout).
func (*TransferSuite) Run ¶
func (s *TransferSuite) Run(t *testing.T)
Run runs every test in the suite as a subtest of t. Subtest names are kept stable (TransferCopyTo, TransferCopyToAndFrom, TransferExecVerify) so existing -test.run filters and CI workflow patterns keep matching. The transfer stress test moved to StressSuite; construct one of those with StressOptions{Transfer: true} to run it.
type UDSSuite ¶
type UDSSuite struct {
// contains filtered or unexported fields
}
UDSSuite contains the UDS-mount tests, gated on the "uds" feature.
func NewUDSSuite ¶
NewUDSSuite constructs a UDSSuite from the given options.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
testbin
command
Testbin is a minimal multicall binary for use inside shimtest containers.
|
Testbin is a minimal multicall binary for use inside shimtest containers. |
|
internal
|
|
|
transfer
Package transfer provides client-side transfer types that marshal into the containerd transfer API protobuf messages.
|
Package transfer provides client-side transfer types that marshal into the containerd transfer API protobuf messages. |