Test Commands
Run these commands from a source checkout to test Onprest.
Test commands require Go 1.26.10 or later as declared in go.mod.
Command Summary
| Command | What it runs |
|---|---|
go test -timeout 60m ./... / make test | Unit tests only. No database or Docker required. |
make vulncheck | Runs the govulncheck version pinned in go.mod and fails on reachable known vulnerabilities in ./.... Release packaging additionally scans each of the ten distributed binaries with govulncheck -mode=binary. |
go test -tags=integration ./it/... / make test-it | Full integration suite against a database. Requires Docker for Testcontainers-backed databases. |
make test-it-postgres-ci | PostgreSQL integration tests, excluding Docker image build tests, run 3 times in a row to catch flakiness. Containers are mandatory. |
make test-it-postgres-stability | DB-interruption stability test (TestPostgresDBUnreachableDuringQuery) run 5 times in a row to confirm the agent handles a database that drops mid-query. |
make test-it-all-db | Every TestContainerDBDriver* test across PostgreSQL, MySQL, SQL Server, and Oracle, with a 30-minute timeout. The common prefix includes the Oracle transaction-start contract and the PostgreSQL nullable OpenAPI and timestamp compatibility cases. Covers real mutation REST/MCP, constraints, timeout/cancel, permissions, transaction-start cancellation, persisted state, OpenAPI 3.1 response validation, and exact timestamp JSON/timezone coercion. |
make test-it-database-tls | Runs the four real-database TLS contracts for PostgreSQL, MySQL, SQL Server, and Oracle. Covers private CA trust, hostname verification, supported client certificates, rotation, and reconnect without plaintext downgrade. Containers are mandatory and the combined timeout is 30 minutes. |
make test-it-docker-ops | Operational tests for the Docker image build and Docker Compose env-file handling (verifies GATEWAY_API_KEYS_JSON and bcrypt $ survive env-file loading). |
make test-it-release-gate | Linux integration component of the full release gate. Runs vulnerability analysis, unit, unit and PostgreSQL integration tests with public schema validation (pinned Ajv, needs Node.js), stability, all-DB conformance, MySQL special-credential, all four DB TLS contracts, and Docker operational checks, and asserts zero reachable vulnerabilities, zero test/subtest skips, and zero leftover Testcontainers resources. Full release readiness additionally requires all native service jobs and release-ready; see Release Gate. |
make release-artifacts VERSION=X.Y.Z RELEASE_TAG=vX.Y.Z RELEASE_SHA=<sha> RELEASE_READY_URL=<url> | Maintainer command: builds five OS/CPU binary archives and one Quick Start archive, records binary dependencies, runs source and binary vulnerability checks, writes SHA256SUMS, and verifies the complete release asset set. |
Unit
go test -timeout 60m ./...make test runs the same command. Keep the explicit timeout: the code worker tests alone take longer than go test’s default of 10 minutes.
Author CLI contracts
go test ./internal/agent -run '^TestCode' -count=1
go test ./internal/contract -run '^Test(InlineFileStrictSharedNormalization|OutputLocalRendererIndependence)$' -count=1
go test -tags=integration ./it -run '^TestSDKPublicResultsRealBinariesRESTAndMCP$' -count=1These build a real agent, run the author commands, and compare the same SDK results through the CLI, REST, and MCP. See Author commands for application commands.
Integration
go test -tags=integration ./it/...Exercises the agent and Gateway against a real database. Driver behavior, placeholder conversion, EXPLAIN validation, SELECT, mutation REST/MCP, constraint normalization, timeout/cancel, persisted state, permissions, and error redaction are covered by the applicable suites.
DB Selection
Select which database the integration tests target with -onprest-it-db.
go test -tags=integration ./it/... -args -onprest-it-db=postgres
go test -tags=integration ./it/... -args -onprest-it-db=mysql
go test -tags=integration ./it/... -args -onprest-it-db=sqlserver
go test -tags=integration ./it/... -args -onprest-it-db=oracle
go test -tags=integration ./it/... -args -onprest-it-db=allall runs every supported driver in sequence. PostgreSQL is the default target for make test-it.
Make Targets
make test # unit tests
make vulncheck # reachable vulnerability analysis
make test-it # integration suite
make test-it-postgres-ci # PostgreSQL CI run, 3x, no Docker build tests
make test-it-postgres-stability # DB-interruption stability, 5x
make test-it-all-db # all-DB + Oracle start + nullable OpenAPI + timestamp, 30m
make test-it-database-tls # PostgreSQL/MySQL/SQL Server/Oracle real-DB TLS contracts
make test-it-docker-ops # Docker image + compose env-file ops tests
make test-it-release-gate # Linux integration component of the full release gate
make release-artifacts VERSION=X.Y.Z RELEASE_TAG=vX.Y.Z RELEASE_SHA=<sha> RELEASE_READY_URL=<url>
# canonical archives, dependency/vulnerability evidence, and checksumsRequired Containers
ONPREST_IT_REQUIRE_CONTAINERS=1 go test -tags=integration ./it/...By default, container-backed tests are skipped when Docker is unavailable. Set ONPREST_IT_REQUIRE_CONTAINERS=1 to make container availability mandatory, so a missing Docker daemon fails the run instead of silently skipping. Use this in CI and release gates where skips are not acceptable.
The release gate fails if containers labeled org.testcontainers=true remain. After an interrupted run, find them with docker ps -a --filter label=org.testcontainers=true and remove them.
The all-driver target runs this exact selection:
ONPREST_IT_REQUIRE_CONTAINERS=1 go test -tags=integration ./it/... -run '^TestContainerDBDriver' -timeout 30m -count=1 -args -onprest-it-db=all