Documentation
¶
Overview ¶
Package blobtest is test support for the blob.Store seam: it starts one Dockerized MinIO per test binary and hands out per-test targets (endpoint, credentials, fresh bucket name) for backends to construct stores against. Production code must never import it. A missing Docker daemon is a hard failure, not a skip: skipped contract tests would silently hollow out the coverage gate (the pgtest rule).
Index ¶
Constants ¶
const ( RootUser = "blobtest" RootPassword = "blobtest-secret" )
Root credentials for the throwaway container (MinIO requires a password of at least 8 characters).
const Image = "minio/minio:RELEASE.2025-09-07T16-13-09Z"
Image is the pinned MinIO the harness runs — the same release deploy/compose and the helm chart default to, so the contract tests exercise what ships.
Variables ¶
This section is empty.
Functions ¶
func Main ¶
Main wraps testing.M: it starts the shared MinIO container, runs the suite, and tears the container down. Use from TestMain: os.Exit(blobtest.Main(m)). The start is attempted twice, with a fresh container in between (#265; the retry's rationale is on pgtest.Main, whose rule this follows). It opens by reaping what an earlier killed run left behind, the defer below being unreachable to one (#346; the rationale is in dockertest).
func Run ¶
Run exercises the blob.Store contract (CLAUDE.md: every backend passes the same shared suite). newStore is called once per subtest so a backend can isolate its own fixtures — for the S3 backend, a fresh bucket per subtest. The suite asserts observable behavior only, never a backend's internals.
Types ¶
type MemStore ¶
type MemStore struct {
// contains filtered or unexported fields
}
MemStore is Mem's implementation. The concrete type is exported so tests can reach behind the API under test (Len, direct Delete) to assert storage side effects.
func Mem ¶
func Mem() *MemStore
Mem returns an in-memory blob.Store for tests exercising logic above the storage seam (the API registry, later the executor's materialization). It holds the same contract as the real backends — the suite in contract.go runs against it in mem_test.go — without a MinIO container, so suites that already carry a Postgres harness need no second one.
type Target ¶
type Target struct {
Endpoint string // host:port, plain HTTP
AccessKey string
SecretKey string
Bucket string
}
Target is one test's connection coordinates: the shared container's endpoint and credentials plus a bucket name no other test uses. The backend under test is expected to create the bucket itself.
func FreshTarget ¶
FreshTarget returns the shared container's coordinates with a bucket name unique to this call.