fixture

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package fixture stands in for the platform on the local kind box (see truvity/policy's hack/kind/README.md and docs/decisions/0005-kind-is-the-gate.md there): a Postgres database and its two roles, a JetStream stream, an S3 bucket — the things a real deployment's platform would already have provisioned before `helm install audit` ever runs.

It reads its names from ONE file, charts/audit/testdata/values/e2e.yaml — the same file `helm upgrade --install` renders the chart with — rather than repeating them here: a value renamed in one place and not the other would otherwise be a silent install failure discovered only on the cluster. See drift_test.go, which renders that file through the chart and fails if the chart stops honouring a name this package gives it.

The database and its host are one fact, the URL in the migration's config, whose role is the owner of the tables; the writer's role is the URL in the writer's config and the indexer's the URL in its own; the query role is the migration's `reader`. What each Secret holds is this package's own choice beyond its name and its key: the database password under `password`, and the connection string too, under `url`, for the suite that connects from outside.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Names

type Names struct {
	Options

	// Database.
	DatabaseHost  string // the box's one Postgres server
	DatabaseName  string // fixture's own choice: the database the owner's role owns
	OwnerRole     string // owns the schema and migrates; no part of the installation connects as it
	OwnerSecret   string // the migration's credential
	WriterRole    string // the deduplication table and the registry, none of the index
	ObserveRole   string // the index and its cursors, as audit-observe reads and writes them
	QueryRole     string // read the values file's own query.database.role: the migrate job grants THIS role, by name
	WriterSecret  string // the writer's credential
	ObserveSecret string // the indexer's credential
	QuerySecret   string // the query role's credential

	// The wide stream.
	StreamURL      string
	StreamName     string
	StreamSubject  string // fixture's own choice: the one subject the stream carries
	StreamConsumer string // stream.consumer — the writer binds its OWN durable consumer under this name

	// The archive.
	Bucket        string
	Region        string
	Endpoint      string
	PathStyle     bool
	LockMode      string
	S3CredsSecret string // existingSecret: AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY
}

Names is everything the fixture creates, and everything the chart install must be given to find it.

func Resolve

func Resolve(o Options) (Names, error)

Resolve reads charts/audit/testdata/values/e2e.yaml and returns the names this package creates and the chart install must be given.

type Options

type Options struct {
	Namespace string
	Release   string
}

Options are the installer's choices.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions are what every script in this tree uses, by calling this rather than repeating them.

Directories

Path Synopsis
cmd
resolve command
Command resolve prints e2e/fixture's names as shell variable assignments, so apply.sh and every hack script that installs onto the same names can `eval` this rather than repeating them.
Command resolve prints e2e/fixture's names as shell variable assignments, so apply.sh and every hack script that installs onto the same names can `eval` this rather than repeating them.

Jump to

Keyboard shortcuts

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