go.bigb.es/cacher/internal/testutil/garage

go.bigb.es/cacher @ v0.1.0 — 176b6cb9 2 months ago

import "go.bigb.es/cacher/internal/testutil/garage"

Overview

Package garage starts a single-node Garage container for end-to-end tests. Garage v2.3+ exposes `server --single-node --default-bucket` which auto-creates the bucket + access key from env vars, so the usual six-step CLI bootstrap (status / layout assign / layout apply / bucket create / key new / bucket allow) becomes a no-op.

Requires Docker on the host. Each call to Start spins up a fresh container with random credentials and binds host ports automatically; t.Cleanup tears it down.

Constants

const Image = "dxflrs/garage:v2.3.0"

Image we pull. Pin to a known-good version so test runs are reproducible.

Types

T type Garage

src
type Garage struct {
	Endpoint  string // http://host:port — feed to cacher --endpoint / config endpoint
	AccessKey string // GK… — feed to CACHER_S3_KEY_ID
	SecretKey string // hex — feed to CACHER_S3_SECRET
	Bucket    string // pre-created bucket the access key owns
	Region    string // always "garage" for this image
}

Garage holds the connection details for the running container.

f func Start

src

Start brings up a Garage container and waits for the S3 API to be responding. Container is automatically terminated via t.Cleanup.

Source files