Skip to content

Commit 92996a1

Browse files
authored
test: add E2E test suite for Phase 2 reconciliation features (#919)
Add 13 integration tests covering all Phase 2 features: Balance assertion via gRPC: - Balanced case (PASSED status, no imbalance event) - Imbalanced case (FAILED status, imbalance event, trend tracking) - Invalid input validation (bad balance, bad UUID) - Run-linked assertion Kafka event publishing: - Full pipeline with event verification - Noop publisher mode (disabled Kafka) Full pipeline with valuation: - Detect -> value -> finalize lifecycle - Valuation engine failure and retry - Multi-instrument reconciliation (3 instruments, 2 variances) PAUSE/RESUME control actions: - Full pause/resume cycle with checkpoint preservation - Invalid state transitions (pause pending, resume pending, resume cancelled) - Cancel from paused state Cross-feature integration: - Pipeline + assertion + events combined Infrastructure changes: - Add last_completed_phase column to settlement_run DDL - Add LastCompletedPhase field to GORM entity and mappings - Set MaxOpenConns(1) to prevent search_path loss on pool connections Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>
1 parent 6963127 commit 92996a1

3 files changed

Lines changed: 777 additions & 23 deletions

File tree

tests/reconciliation-e2e/infra_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ func setupE2EInfra(t *testing.T) *e2eTestInfra {
8080
infra.db = db
8181
infra.cleanup = cleanup
8282

83+
// Limit the connection pool to 1 so all operations (including concurrent
84+
// errgroup goroutines) share the same connection with search_path set.
85+
// Without this, new pool connections would miss the tenant search_path.
86+
sqlDB, err := db.DB()
87+
require.NoError(t, err)
88+
sqlDB.SetMaxOpenConns(1)
89+
8390
// Set up tenant schema and apply migrations
8491
tc := testdb.SetupTenantSchema(t, db, "e2e_recon_tenant")
8592
t.Cleanup(tc.Cleanup)
@@ -221,6 +228,7 @@ func applyMigrations(t *testing.T, db *gorm.DB, _ tenant.TenantID) {
221228
completed_at timestamptz NULL,
222229
variance_count integer NOT NULL DEFAULT 0,
223230
failure_reason text NULL,
231+
last_completed_phase character varying(30) NULL,
224232
attributes jsonb NULL,
225233
version bigint NOT NULL DEFAULT 1,
226234
PRIMARY KEY (id)

0 commit comments

Comments
 (0)