#!/usr/bin/env bash # # Local conformance entrypoint, under plain go test: # # ./scripts/conformance.sh # # Three tiers exercise the storage conformance contract: the in-process # storage corpus against the embedded-Dolt oracle, the real-binary CLI # corpus, then the served HTTP client/role corpus against a real server. # CI runs all three tiers as Bazel targets, remotely: # # bazel test --config=embedded //internal/storage/embeddeddolt:embeddeddolt_conformance_core_test \ # //internal/storage/embeddeddolt:embeddeddolt_conformance_audit_test # bazel test --config=integration //test/conformance:conformance_test # bazel test --config=embedded //internal/httpclient:httpclient_served_test # set -euo pipefail cd "$(dirname "$0")/.." TAGS="gms_pure_go" # assert_conformance_passed LOGFILE LABEL # Fail the gate unless the top-level TestConformance in LOGFILE ran and PASSED. The # checks MUST anchor to column-0 result lines: `go test -v` indents subtest results, and # RunAll legitimately skips backend-inapplicable subtests (e.g. Claim concurrency on the # single-writer embedded-Dolt reference), so an unanchored `--- SKIP: TestConformance` # grep would match an indented subtest and false-fail the gate even though the top-level # suite passed. Deletes LOGFILE either way. assert_conformance_passed() { local log="$1" label="$2" if grep -qE '^--- SKIP: TestConformance' "$log" || ! grep -qE '^--- PASS: TestConformance' "$log"; then rm -f "$log" echo "FATAL: $label conformance (top-level TestConformance) skipped or did not run; storage-parity gate is not enforced" >&2 exit 1 fi rm -f "$log" } echo "==> Tier 1: in-process store conformance + wedge gates" # The embedded-Dolt backend runs the full backend-agnostic suite (conformance.RunAll) as # the reference oracle any future backend is compared against. BEADS_TEST_EMBEDDED_DOLT=1 # is REQUIRED, not optional: without it that suite self-skips # (internal/storage/embeddeddolt/conformance_test.go), which would let this whole # storage-parity gate report success while never running the oracle. Run it with -v and # fail loudly if the top-level TestConformance skips or reports no pass, so the gate can # never go green on a silent skip. # (assert_conformance_passed explains why the skip/pass checks anchor to column-0 lines.) embedded_dolt_log="$(mktemp)" BEADS_TEST_EMBEDDED_DOLT=1 CGO_ENABLED=1 go test -tags "$TAGS" -v \ -timeout 30m ./internal/storage/embeddeddolt/ -run TestConformance | tee "$embedded_dolt_log" assert_conformance_passed "$embedded_dolt_log" "embedded-Dolt reference (need BEADS_TEST_EMBEDDED_DOLT=1)" echo "==> Tier 2: end-to-end 'bd init' + CLI conformance (reference round-trip)" CGO_ENABLED=1 go test -tags "$TAGS e2e" -timeout 10m ./test/conformance/ echo "==> Tier 3: served HTTP client/role conformance (real server, real wire)" # The httpclient package's served_*_test.go files are gated by the `cgo` # build tag (set automatically when CGO_ENABLED=1; no -tags entry needed) and # self-skip without BEADS_TEST_EMBEDDED_DOLT=1 + BEADS_HTTP_TEST_REQUIRED=1 -- # the latter is a fail-loud guard (not a silent skip) if it's set without the # former, so a misconfigured env can't report a false green here either. # Nor can a build with cgo off, which drops every served file: the package's # untagged TestServedTierIsLinkedWhenRequired fails a required run then. # Here the tier is one unsharded invocation, like Tier 1 and Tier 2 above; # -timeout=40m matches the budget the review asked for. The embedded lane's # httpclient_served_test runs the same package and env on the race build, # split into shards (rules_go deals the tests out round-robin) so each fits # the lane's 1200s action limit. CGO_ENABLED=1 BEADS_TEST_EMBEDDED_DOLT=1 BEADS_HTTP_TEST_REQUIRED=1 \ go test -tags "$TAGS" -timeout=40m ./internal/httpclient/ echo "==> conformance OK"