Skip to content

Commit 6e2f7d2

Browse files
committed
chore: add CI config for live postgres and openbao tests
1 parent 4ed2d91 commit 6e2f7d2

1 file changed

Lines changed: 58 additions & 5 deletions

File tree

.github/workflows/go-test.yml

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: Go Test
22

3-
# Two-stage test pipeline mirroring the local `make test` / `make itest`
4-
# split: fast unit tests run first (the shared unified workflow), and the
5-
# Docker-backed integration suite (itest/) only runs once they pass — a
6-
# broken unit test fails the PR in ~2 minutes instead of tying up a runner
7-
# booting the Forge stack.
3+
# Three test jobs mirroring the local split: fast unit tests (the shared
4+
# unified workflow) and the env-gated live tests (real Postgres + OpenBao as
5+
# service containers) run in parallel, and the Docker-backed integration
6+
# suite (itest/) only runs once the unit job passes — a broken unit test
7+
# fails the PR in ~2 minutes instead of tying up a runner booting the Forge
8+
# stack. The live job exists because the unit job runs the same packages
9+
# with no INGOT_TEST_* env, silently skipping every *_live_test.go.
810

911
on:
1012
pull_request:
@@ -27,6 +29,57 @@ jobs:
2729
secrets:
2830
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2931

32+
live:
33+
# The env-gated live tests: the SQL-backed stores and migrations against
34+
# a real Postgres, and the OpenBao transit provider against a real
35+
# OpenBao — behavior the in-memory fakes and httptest doubles cannot
36+
# prove (bytea[] round-trips, CHECK constraints, derived-context
37+
# binding, key rotation). Cheap enough to run in parallel with unit.
38+
runs-on: ubuntu-24.04
39+
timeout-minutes: 10
40+
41+
services:
42+
postgres:
43+
image: postgres:17
44+
env:
45+
POSTGRES_PASSWORD: pw
46+
POSTGRES_DB: ingot
47+
ports:
48+
- 55432:5432
49+
options: >-
50+
--health-cmd "pg_isready -U postgres"
51+
--health-interval 2s
52+
--health-timeout 5s
53+
--health-retries 15
54+
openbao:
55+
image: openbao/openbao:2.6.2
56+
env:
57+
BAO_DEV_ROOT_TOKEN_ID: root
58+
ports:
59+
- 8200:8200
60+
options: >-
61+
--health-cmd "wget -q -O /dev/null http://127.0.0.1:8200/v1/sys/health"
62+
--health-interval 2s
63+
--health-timeout 5s
64+
--health-retries 15
65+
66+
steps:
67+
- name: Check out the repository
68+
uses: actions/checkout@v7
69+
70+
- name: Set up Go
71+
uses: actions/setup-go@v7
72+
with:
73+
go-version-file: go.mod
74+
75+
- name: Run live tests
76+
env:
77+
GOWORK: off
78+
INGOT_TEST_DSN: postgres://postgres:pw@127.0.0.1:55432/ingot
79+
INGOT_TEST_BAO_ADDR: http://127.0.0.1:8200
80+
INGOT_TEST_BAO_TOKEN: root
81+
run: go test -v -count=1 -run Live ./registry/ ./migrations/ ./regionkey/
82+
3083
itest:
3184
needs: unit
3285
# Pin to 24.04 rather than -latest so the Docker version doesn't drift

0 commit comments

Comments
 (0)