Fix the try: guard shared test state with mutexes, pgxpool over one conn, a short batch gap for integration builds, unique+forced database drops (issues 1431, 1524, 1517)

This commit is contained in:
jochen
2026-10-21 01:11:48 +02:00
parent d61fe4e2da
commit 794de09c4d
7 changed files with 186 additions and 57 deletions
@@ -0,0 +1,20 @@
//go:build integration
package main
import "time"
// batch_gap_integration.go shortens BatchGap (batch.go) for a binary built with `go build -tags
// integration` alone — never a production build, which never carries that tag, and never a setting an
// operator or the manifest could change (novox/hq ADR 0459 §15 still holds there: at least 160s). This is
// what lets an integration test (acceptance_integration_test.go, catchup_integration_test.go) exercise the
// reader's real pacing loop without actually waiting out 160s for each batch; a unit test on a test clock
// (batch_test.go's TestNextBatchWait, TestThirtyWaitingMailsRunAsThreeBatchesAtLeast160sApart) still proves
// the real 160s value, unaffected by this file, which they are never built with.
//
// issue 1431 (named by the lead's merge-check feedback, which also named 1524 and 1517): the earlier
// integration tests waited out the real pacing (one took 161.62s), which the merge check's own time bound
// for the integration level refuses.
func init() {
BatchGap = 3 * time.Second
}