Documentation
¶
Index ¶
- func CatFile(ctx context.Context, t *testing.T, container testcontainers.Container, ...)
- func ExecCapture(ctx context.Context, t *testing.T, container testcontainers.Container, ...) string
- func ExecOK(ctx context.Context, t *testing.T, container testcontainers.Container, ...)
- func LsSnapshot(ctx context.Context, t *testing.T, container testcontainers.Container, ...)
- func NewNetwork(ctx context.Context, t *testing.T) *testcontainers.DockerNetwork
- func StartPlakarContainer(ctx context.Context, t *testing.T, net *testcontainers.DockerNetwork) testcontainers.Container
- func StartPostgresContainer(ctx context.Context, t *testing.T, net *testcontainers.DockerNetwork, ...) testcontainers.Container
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CatFile ¶
func CatFile(ctx context.Context, t *testing.T, container testcontainers.Container, store, snapshotID, path string)
CatFile runs `plakar at <store> cat <snapshotID>:<path>` and logs the output.
func ExecCapture ¶
func ExecCapture(ctx context.Context, t *testing.T, container testcontainers.Container, cmd ...string) string
ExecCapture runs cmd inside container and returns its combined output as a string. The test fails if the exit code is non-zero.
func ExecOK ¶
ExecOK runs cmd inside container, streams the combined output to t.Log, and fails the test if the exit code is non-zero.
func LsSnapshot ¶
func LsSnapshot(ctx context.Context, t *testing.T, container testcontainers.Container, store, snapshotID string)
LsSnapshot runs `plakar at <store> ls <snapshotID>` and logs the output.
func NewNetwork ¶
func NewNetwork(ctx context.Context, t *testing.T) *testcontainers.DockerNetwork
NewNetwork creates an isolated Docker network for the duration of the test. The network is removed automatically when the test ends.
func StartPlakarContainer ¶
func StartPlakarContainer(ctx context.Context, t *testing.T, net *testcontainers.DockerNetwork) testcontainers.Container
StartPlakarContainer starts a container from the plakar test image. The image already has plakar and the postgresql plugin installed (built during the Docker image build from the repository source). net is an optional Docker network to attach the container to; pass nil when no extra network is needed. The container is automatically terminated when the test ends.
func StartPostgresContainer ¶
func StartPostgresContainer(ctx context.Context, t *testing.T, net *testcontainers.DockerNetwork, alias string) testcontainers.Container
StartPostgresContainer starts a postgres:17 container attached to net with the given network alias, a default database named "testdb" (password "secret").
The server is configured with wal_level=replica and a pg_hba.conf rule that allows replication connections from any host, so both logical and physical (pg_basebackup) backups work against the same container.
The container is automatically terminated when the test ends.
Types ¶
type Snapshot ¶
type Snapshot struct {
ID string
}
Snapshot represents a single entry returned by `plakar at <store> ls`.
func ListSnapshots ¶
func ListSnapshots(ctx context.Context, t *testing.T, container testcontainers.Container, store string) []Snapshot
ListSnapshots runs `plakar at <store> ls`, logs the output, and returns the list of snapshots found in the store.