Documentation
¶
Overview ¶
Package backendtest is the parameterized interface-conformance test for container.Backend. It exercises ONLY what every Backend impl is contractually obliged to do (Capabilities returns a known mode; Create→Destroy lifecycle; Snapshot/Restore route ErrUnsupported when Caps says "none"; double-Destroy errors per the io.Closer convention).
Backend-specific behavior tests (scripted Exec for the fake, real shell execution for Docker, fault hooks for the fake) live in each backend's own *_test.go file. Phase 2 has one Backend — building a Factory + callback machinery here would be the speculative abstraction CLAUDE.md forbids ("no speculative interfaces, registries, or plugin layers"). When Phase 4's Docker impl exists, we'll learn which abstraction shape actually pays.
Pattern: Go stdlib testing/fstest. Used both by Phase 2's fake (slice 2.2) and Phase 4's Docker impl unchanged.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunBasicContract ¶
RunBasicContract verifies that b honors the container.Backend interface contract. Caller passes a configured Backend instance; the helper does the rest. Each sub-test takes b as-is — for tests that need a clean slate, the caller can re-create the backend before each RunBasicContract call.
func RunCopyToContract ¶
RunCopyToContract verifies CopyTo stages bytes that a subsequent CaptureFiles reads back (the artifact round-trip). Uses a NESTED destination path so the Docker impl exercises parent-directory creation. Caller passes a configured Backend; the helper Creates/Destroys its own container.
func RunSnapshotContract ¶
RunSnapshotContract verifies that b honors the Snapshot+Restore round-trip contract for backends advertising SnapshotFSCoW. Skipped on SnapshotNone backends — their behavior is covered by RunBasicContract's testSnapshotRouting sub-test.
- image: the digest-pinned reference Create will use.
- name: the IR-declared container name (passed to Restore per slice 4.4 Design Q9).
Three sub-tests align with Phase 4 design decision 12 (Bucket 11):
- WorkspaceMutationCapturedAndRestored (11a)
- DeletedFileRestoredAsDeleted (11b)
- SmallWorkspaceDoesNotTripDefaultCap (smoke; the real cap-trip assertion is Docker integ TestBucket11c via WithSnapshotMaxBlobBytes).
Types ¶
This section is empty.