cluster

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TestQueue1 = "queue-cluster-tests-1"
	TestQueue2 = "queue-cluster-tests-2"
	TestQueue3 = "queue-cluster-tests-3"
)

The task queues this package uses.

Deliberately *not* queue-1/2/3: those are what the compose cluster's three workers serve (docker-compose.cluster.yml), so a test that inserts a workflow there and then claims it races a live worker that is doing the same thing. TestFullClusterRestart failed exactly that way -- it released a workflow and asserted it could claim it back, and worker-1 got there first.

These tests exercise the store's claim/release/replay bookkeeping against the cluster's database. The live workers' behaviour is tests/exhaustion's job.

Variables

This section is empty.

Functions

func EnsureDef

func EnsureDef(t *testing.T, db *sql.DB, name string, version int)

EnsureDef inserts the workflow_defs row a test's instances refer to.

migrations/postgres/001_schema.sql puts `FOREIGN KEY (def_name, def_version) REFERENCES workflow_defs(name, version)` on workflow_instances, and every test in this package inserts instances with a raw INSERT naming a definition it never created. Against the real schema all eleven failed on that constraint -- the suite is in UNWIRED_SUITES (scripts/check-ci-package-coverage.sh) and nothing had ever run it.

The bytes are a bare WASM header. Nothing here executes the module: these tests are about claiming, failover and replay bookkeeping, not about running guest code.

func GetDB

func GetDB(t *testing.T) *sql.DB

GetDB returns a *sql.DB connected to the cluster's PostgreSQL instance.

func SetupCluster

func SetupCluster(t *testing.T)

SetupCluster starts the cluster via docker compose and waits for all workers to become healthy.

`docker compose`, not `docker-compose`. The hyphenated v1 binary is gone from current GitHub runners and from Docker Desktop; ci.yml's cluster job has used the v2 plugin form throughout. This package still shelled out to v1, so the first thing it would have done on a runner is fail to find the command.

func TeardownCluster

func TeardownCluster(t *testing.T)

TeardownCluster stops and removes all cluster containers and volumes.

func WaitForReady

func WaitForReady(t *testing.T, timeout time.Duration)

WaitForReady polls each worker's /healthz endpoint until all respond or the timeout elapses.

Types

This section is empty.

Jump to

Keyboard shortcuts

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