secretstest

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package secretstest is test support for the secrets.Cipher seam: the shared contract suite (contract.go) plus a Dockerized OpenBao dev-mode container started once per test binary, with the transit engine mounted and per-test key names handed out. 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

View Source
const Image = "openbao/openbao:2.6.1"

Image is the pinned OpenBao the harness runs — the same release deploy/compose and the helm chart default to, so the contract tests exercise what ships.

View Source
const RootToken = "secretstest-root"

RootToken is the dev-mode root token for the throwaway container.

Variables

This section is empty.

Functions

func Addr

func Addr(t *testing.T) string

Addr returns the dev container's base URL (http://host:port).

func FreshKey

func FreshKey(t *testing.T) string

FreshKey returns a transit key name unique to this call. The backend under test is expected to create the key itself.

func Main

func Main(m *testing.M) int

Main wraps testing.M: it starts the shared OpenBao dev container (transit engine mounted), runs the suite, and tears the container down. Use from TestMain: os.Exit(secretstest.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

func Run(t *testing.T, newCipher func(t *testing.T) secrets.Cipher)

Run is the shared contract suite every secrets.Cipher backend must pass. newCipher is called once per subtest so backends isolate fixtures (a fresh transit key per subtest for OpenBao).

Types

This section is empty.

Jump to

Keyboard shortcuts

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