testutil/

directory
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0

README

internal/testutil

Overview

Shared test helpers. This directory has no Go files of its own. Its four child packages pin the container images that tests start, capture container logs for CI artifacts, inject COMMIT faults into PostgreSQL connections, and hold a test server's port while the server is down.

Subdirectories & Boundaries

  • heldport: ./heldport/README.md - Listen and Relisten keep a test server's TCP port reserved while the server is down, on Linux only, so a restart reuses the address, and in between only a same-user socket that also sets SO_REUSEPORT and binds that exact port can take it. Off Linux they are plain listeners
  • pgfault: ./pgfault/README.md - a TCP proxy for PostgreSQL that loses, drops, holds, or delays the next COMMIT, for tests of a COMMIT whose outcome the client never hears
  • seaweedcapture: ./seaweedcapture/README.md - wraps testcontainers.GenericContainer; when OPENSTORAGE_TEST_ARTIFACT_DIR is set it writes each container's stdout, stderr, and a JSON receipt to a private directory. Setup checks fail closed: [seaweedcapture/capture.go:start] returns an error and creates no container when TESTCONTAINERS_SESSION_ID is missing or unsafe, the artifact directory is not a mode-0700 directory or cannot be opened, or the request is not Started or already has log configuration, and the PostCreate hook [seaweedcapture/capture.go:attach] fails container creation on a container attribution or session-label mismatch. Runtime capture-file failures, a failed container creation (startup-error), and a failed cleanup after it (teardown-error) become receipt problems ([seaweedcapture/capture.go:problem]); capture-file failures never change the fixture result
  • testimages: ./testimages/README.md - two pinned image references, Postgres and SeaweedFS, as tag plus index digest; no executable code

Directories

Path Synopsis
Package heldport keeps a test server's TCP port reserved while the server is down, on Linux only, so a test can stop a server and start it again on the same address.
Package heldport keeps a test server's TCP port reserved while the server is down, on Linux only, so a test can stop a server and start it again on the same address.
Package pgfault relays PostgreSQL connections through a local TCP proxy and injects one fault into the next COMMIT, for tests of a COMMIT whose outcome the client does not learn.
Package pgfault relays PostgreSQL connections through a local TCP proxy and injects one fault into the next COMMIT, for tests of a COMMIT whose outcome the client does not learn.
Package seaweedcapture retains opt-in, private logs for SeaweedFS test fixtures.
Package seaweedcapture retains opt-in, private logs for SeaweedFS test fixtures.
Package testimages pins the container images that tests and fixtures pull.
Package testimages pins the container images that tests and fixtures pull.

Jump to

Keyboard shortcuts

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