From 71a9f9146236edb205ba013c2609af761e92e284 Mon Sep 17 00:00:00 2001 From: Julian Knutsen Date: Wed, 7 Oct 2026 03:56:47 +0000 Subject: [PATCH] ci(bazel): retire the docker A/B variants and pr.yml's container jobs The dolt-server lane (--config=doltserver) has been the only pre-merge run of the Dolt-backed domain, uow, tracker, doctor/fix and protocol suites since BAZEL_COVERS_FORKS went "true": bazel-coverage reports pr_lanes=true for every pull_request and merge_group, so pr.yml's test-domain-uow and contract-corpus never run. An A/B run of every requires-docker target against its dolt-server twin on the same commit shows identical test sets and statuses (2683 testcases) except TestDoltServerFingerprint/container, the container half of the fingerprint, which needs docker by design. Delete the six requires-docker sh_tests, test:docker in .bazelrc, the requires-docker tag from the taxonomy and lane filters, bazel.yml's dolt-lane dispatch input and image pull, and pr.yml's test-domain-uow and contract-corpus jobs with their ci-gate wiring. The testcontainers backend in internal/testutil stays: it is plain go test's default. pull-dolt-image.sh stays for pr-risk.yml's legacy tiers. No required check changes: the rulesets require only CI Gate / Required and PR Risk Gate / Required. Refs ga-96smfk.21 Co-Authored-By: Claude Opus 5.5 (1M context) --- .bazelrc | 70 +++------ .github/workflows/bazel.yml | 56 +++---- .github/workflows/pr.yml | 188 ++-------------------- cmd/bd/doctor/fix/BUILD.bazel | 41 +---- cmd/bd/protocol/BUILD.bazel | 51 +----- engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md | 42 +++-- engdocs/TESTING.md | 8 +- internal/storage/domain/db/BUILD.bazel | 33 +--- internal/storage/uow/BUILD.bazel | 40 +---- internal/testutil/BUILD.bazel | 31 +--- internal/tracker/BUILD.bazel | 27 +--- scripts/bazel_policy_test.go | 49 +++--- scripts/ci_merge_queue_test.go | 10 +- scripts/ci_workflow_test.go | 199 +++++------------------- scripts/pr_lanes_bazel_coverage_test.go | 53 +++---- scripts/pr_risk_bazel_coverage_test.go | 12 +- scripts/pull_dolt_image_test.go | 24 ++- tools/bazel/BUILD.bazel | 2 +- tools/bazel/equivalence.py | 2 +- tools/bazel/race.bzl | 12 +- 20 files changed, 210 insertions(+), 740 deletions(-) diff --git a/.bazelrc b/.bazelrc index 9855a5177..dcd27c345 100644 --- a/.bazelrc +++ b/.bazelrc @@ -49,7 +49,7 @@ test:prcore --test_env=BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION=1 # Every tag that belongs to another lane (scripts/bazel_policy_test.go # bazelPRCoreExcludedTags). integration-only targets run zero tests outside # --config=integration. -test:prcore --test_tag_filters=-requires-docker,-dolt-server,-dolt-server-proxied,-dolt-server-integration,-dolt-server-cmd,-embedded,-manual,-integration-only +test:prcore --test_tag_filters=-dolt-server,-dolt-server-proxied,-dolt-server-integration,-dolt-server-cmd,-embedded,-manual,-integration-only test:ci --config=prcore test:ci --keep_going --test_summary=terse @@ -62,29 +62,6 @@ test:ci --remote_download_regex=.*/test\.xml$ # bazel.yml publishes the non-race bd as pr.yml's ci-build-artifacts. test:ci --remote_download_regex=.*/bin/cmd/bd/bd_for_tests/bd$ -# Docker lane: only the requires-docker targets (pr.yml's container-backed -# jobs "Test (storage domain + uow)" and "Contract corpus"), on a host with a -# docker daemon. Race like the domain+uow job (//cmd/bd/protocol's variant -# opts out, like the non-race Contract corpus job), but no -short and no -# BEADS_TEST_SKIP=dolt, which would keep the containers from starting. Those -# targets are also tagged no-remote-exec, so they run on the host even with -# --config=remote-exec; their builds may still run remotely. -test.v in -# test.xml, as in test:ci, lets equivalence.py see which tests ran. -test:docker --@rules_go//go/config:race -test:docker --test_tag_filters=requires-docker -test:docker --build_tests_only -test:docker --keep_going -test:docker --test_env=GO_TEST_WRAP_TESTV=1 -# Those jobs pass no -p/-parallel, so go test uses GOMAXPROCS, ubuntu-latest's -# 4 vCPUs, for both. Match that on any host: 4 test processes (hence at most -# 4 dolt containers starting at once) and -test.parallel=4. -test:docker --local_test_jobs=4 -test:docker --test_arg=-test.parallel=4 -# The variants depend on host state no action key sees (the docker daemon, -# the pulled dolt image, the network), so a cached result proves nothing about -# this host: always run them, like the jobs' `go test -count=1`. -test:docker --nocache_test_results - # Embedded-Dolt tier: PR Risk's embedded jobs ("Test (Embedded Dolt Cmd # N/20)", "Test (Embedded Dolt Storage N/5)", "Test (Embedded Dolt # Conformance - core/audit)"), as the `embedded`-tagged variants of bd_test @@ -121,26 +98,26 @@ test:embedded --remote_download_regex=.*/test\.xml$ # visible "Re-run failed jobs" retries it. test:embedded --experimental_remote_cache_eviction_retries=0 -# Dolt-server lane: the same jobs as the docker lane ("Test (storage domain + -# uow)" and "Contract corpus"), but every dolt sql-server is a child of the -# test process, started from the pinned dolt in the test wrapper's runfiles -# (BEADS_TEST_DOLT_SERVER=local, set by each dolt-server target), so the -# targets run on remote workers and need no docker. Same selection rules as -# test:docker: race (//cmd/bd/protocol's variant opts out, like its job), no -# -short, no BEADS_TEST_SKIP=dolt, -test.parallel=4, and the no--short twins -# of the job's other packages. Results are cacheable: every input (test -# binary, dolt, env) is in the action key, and a server that cannot start -# fails the target (BEADS_TEST_REQUIRE_DOLT_CONTAINER=1) instead of skipping. -# --config=docker stays as the A/B control. test.xml is downloaded for -# tools/bazel/equivalence.py --job, test.log for bazel.yml's failure artifact. +# Dolt-server lane: what pr.yml's retired container-backed jobs ("Test +# (storage domain + uow)" and "Contract corpus") ran, but every dolt +# sql-server is a child of the test process, started from the pinned dolt in +# the test wrapper's runfiles (BEADS_TEST_DOLT_SERVER=local, set by each +# dolt-server target), so the targets run on remote workers and need no +# docker. As those jobs: race (//cmd/bd/protocol's variant opts out, like its +# job), no -short, no BEADS_TEST_SKIP=dolt, -test.parallel=4, and the +# no--short twins of the job's other packages. Results are cacheable: every +# input (test binary, dolt, env) is in the action key, and a server that +# cannot start fails the target (BEADS_TEST_REQUIRE_DOLT_CONTAINER=1) instead +# of skipping. test.xml is downloaded for tools/bazel/equivalence.py --job, +# test.log for bazel.yml's failure artifact. test:doltserver --@rules_go//go/config:race test:doltserver --test_tag_filters=dolt-server test:doltserver --build_tests_only test:doltserver --keep_going test:doltserver --test_env=GO_TEST_WRAP_TESTV=1 test:doltserver --test_arg=-test.parallel=4 -# Locally (fork PRs, rbe=off, no executor): at most 4 test processes, as in -# test:docker; remote workers are not limited by it. +# Locally (rbe=off, no executor): at most 4 test processes, the jobs' 4-vCPU +# runner shape; remote workers are not limited by it. test:doltserver --local_test_jobs=4 test:doltserver --remote_download_regex=.*/test\.(log|xml)$ @@ -262,7 +239,7 @@ test:integration --test_env=BEADS_TEST_SKIP=dolt # required exclusions from the PR-core list, so a new lane tag lands here too. # pr-core-only targets (the historical-release suites: shell tests against # the release-shaped bd, which the PR-core lane already runs) stay out too. -test:integration --test_tag_filters=-requires-docker,-dolt-server,-dolt-server-proxied,-dolt-server-integration,-dolt-server-cmd,-embedded,-manual,-pr-core-only +test:integration --test_tag_filters=-dolt-server,-dolt-server-proxied,-dolt-server-integration,-dolt-server-cmd,-embedded,-manual,-pr-core-only test:integration --build_tests_only test:integration --keep_going test:integration --test_summary=terse @@ -320,14 +297,13 @@ build:js-wasm --remote_download_outputs=toplevel # retry would report green. test:sole-run --experimental_remote_cache_eviction_retries=0 -# Test result caching. Every lane but docker caches its test results (read -# and write; Bazel's default): a test whose action key (test binary, -# runfiles, test env, platform) is unchanged reuses the PASS the farm -# recorded for it, on a PR (any attempt), a merge group or a push to main, -# so only what a change touched runs. Why that is safe: +# Test result caching. Every lane caches its test results (read and write; +# Bazel's default): a test whose action key (test binary, runfiles, test env, +# platform) is unchanged reuses the PASS the farm recorded for it, on a PR +# (any attempt), a merge group or a push to main, so only what a change +# touched runs. Why that is safe: # - Identical key, identical test: these targets are hermetic (dolt and -# every input are runfiles). The docker lane depends on host state no -# key sees and keeps --nocache_test_results above. +# every input are runfiles). # - A cached failure is never reused: Bazel treats a failed cached action # as a miss, so whatever failed re-runs. # - Only rbe-west's workers write the action cache (clients' writes are @@ -385,7 +361,7 @@ build:remote-exec --remote_download_minimal build:remote-exec --remote_timeout=600 build:remote-exec --remote_retries=3 # Upload only remotely executed results. A locally executed action (a -# no-remote-exec test, a host-dependent docker-lane result) must not seed the +# no-remote-exec test, whose result depends on the host) must not seed the # shared cache that CI and every other developer read. build:remote-exec --noremote_upload_local_results diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index f0da60d84..4360600f6 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -1,6 +1,6 @@ # Bazel side-by-side lane, gated alongside the legacy go test jobs. Runs # `bazel test //... --config=ci`, the PR Core-parity selection (race, -short, -# dolt skip, -requires-docker), plus one job per mirrored CI job (pure-Go and +# dolt skip), plus one job per mirrored CI job (pure-Go and # js/wasm, the dolt-server lane, pr-risk.yml's embedded-Dolt, proxied-server # and server-Dolt storage tiers, main.yml's integration jobs). # @@ -13,9 +13,9 @@ # bazel-coverage job stands down pr-risk.yml's embedded-Dolt test jobs (bazel-embedded runs # the tier), its proxied-server and server-Dolt storage test jobs # (bazel-proxied, bazel-server-storage), or pr.yml's PR Core, -# build-artifacts, pure-Go/js-wasm, domain+uow and contract corpus jobs -# (bazel-test, bazel-pure, bazel-doltserver; their `bazel test`s then add -# --config=sole-run); pr.yml's ci-gate then requires those lanes to have run +# build-artifacts and pure-Go/js-wasm jobs (bazel-test, bazel-pure; their +# `bazel test`s then add --config=sole-run, as bazel-doltserver's does: it +# is the only run of the retired domain+uow and contract corpus jobs' tests); pr.yml's ci-gate then requires those lanes to have run # remotely and passed, so modes skip, local and cache are red there # (scripts/pr_risk_bazel_coverage_test.go, pr_lanes_bazel_coverage_test.go). # Test results are cached (read and written) on every run but nightly's: a @@ -200,12 +200,6 @@ on: required: false type: boolean default: false - dolt-lane: - description: "Dolt-backed lane: doltserver (hermetic, remote) or docker (testcontainers A/B control)" - required: false - type: choice - default: "doltserver" - options: [ "doltserver", "docker" ] fresh-test-results: description: "Re-execute every test (--config=fresh: no cached test results), as nightly does" required: false @@ -798,8 +792,8 @@ jobs: # pr.yml's build-artifacts job, built by Bazel: the same artifact name # and layout (bd-linux-gms-pure, SHA256SUMS, build-manifest.txt). Where - # build-artifacts stands down (D2 step 3), its other consumers (PR - # Core, domain+uow) stand down there too. F3: the package gates build + # build-artifacts stands down (D2 step 3), its other consumer (PR + # Core) stands down there too. F3: the package gates build # their own bd and no longer consume this artifact; it is kept for the # F3.5.3 SHA256SUMS comparison and for debugging. The script documents # which binary and how it differs from `go build`'s. @@ -1379,14 +1373,12 @@ jobs: JOB_STATUS: ${{ job.status }} run: echo "result=$JOB_STATUS" >> "$GITHUB_OUTPUT" - # pr.yml's container-backed jobs, "Test (storage domain + uow)" and - # "Contract corpus", as Bazel's dolt-server lane: --config=doltserver runs - # the dolt-server variants (domain/..., uow in 8 shards, tracker/..., - # doctor/fix, protocol in 8 shards), each of which starts its own dolt - # sql-server from the pinned dolt, so they execute on the remote workers - # like any other test (locally for forks and rbe=off). The docker lane - # (--config=docker: the same suites against testcontainers on this runner, - # no-remote-exec) stays the A/B control: dispatch with dolt-lane=docker. + # pr.yml's retired container-backed jobs, "Test (storage domain + uow)" + # and "Contract corpus", as Bazel's dolt-server lane: --config=doltserver + # runs the dolt-server variants (domain/..., uow in 8 shards, tracker/..., + # doctor/fix, protocol in 8 shards, testutil), each of which starts its + # own dolt sql-server from the pinned dolt, so they execute on the remote + # workers like any other test (locally with rbe=off). bazel-doltserver: name: dolt-server lane # Same runner and skip rule as bazel-test. @@ -1397,13 +1389,11 @@ jobs: outputs: result: ${{ steps.result.outputs.result }} env: - BAZEL_DOLT_LANE: ${{ inputs.dolt-lane || 'doltserver' }} - # D2 step 3: on covered PRs and merge groups (always mode remote) this - # lane is the only pre-merge run of pr.yml's legacy domain+uow and - # contract corpus jobs, which never retried: --config=sole-run then - # fails on a remote cache eviction instead of re-running the whole - # invocation (whose retry could turn a failed test green). Fork modes do - # the same (with BAZEL_COVERS_FORKS "true" it is their only run too). + # This lane is the only pre-merge run of these suites (the go test + # jobs it replaced never retried): where it executes remotely + # --config=sole-run fails on a remote cache eviction instead of + # re-running the whole invocation (whose retry could turn a failed + # test green). # Test results are cached and reused like every lane's; only nightly # re-executes them all (BAZEL_FRESH). BAZEL_SOLE_RUN: ${{ needs.rbe.outputs.enabled == 'true' && '--config=sole-run' || '' }} @@ -1431,12 +1421,6 @@ jobs: RBE_FORK_TIER: ${{ needs.rbe.outputs.tier }} RBE_FORK_PR: ${{ github.event.pull_request.number }} - # Docker lane only (the A/B control), as in the mirrored jobs; its - # tests fail rather than skip without the image. - - name: Pull Dolt sql-server image - if: ${{ env.BAZEL_DOLT_LANE == 'docker' }} - run: ./scripts/ci/pull-dolt-image.sh - - name: bazel test //... --config=doltserver id: test timeout-minutes: 80 @@ -1444,8 +1428,8 @@ jobs: set -o pipefail start=$(date +%s) rc=0 - bazel test //... "--config=$BAZEL_DOLT_LANE" ${BAZEL_SOLE_RUN:+"$BAZEL_SOLE_RUN"} ${BAZEL_FRESH:+"$BAZEL_FRESH"} 2>&1 | tee "$RUNNER_TEMP/bazel-test.log" || rc=$? - echo "bazel test --config=$BAZEL_DOLT_LANE: exit $rc, $(( $(date +%s) - start ))s wall" | tee -a "$GITHUB_STEP_SUMMARY" + bazel test //... --config=doltserver ${BAZEL_SOLE_RUN:+"$BAZEL_SOLE_RUN"} ${BAZEL_FRESH:+"$BAZEL_FRESH"} 2>&1 | tee "$RUNNER_TEMP/bazel-test.log" || rc=$? + echo "bazel test --config=doltserver: exit $rc, $(( $(date +%s) - start ))s wall" | tee -a "$GITHUB_STEP_SUMMARY" exit "$rc" - name: Upload test logs @@ -1453,7 +1437,7 @@ jobs: uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: overwrite: true # a job re-run is the same run: replace, not 409 - name: bazel-${{ env.BAZEL_DOLT_LANE }}-testlogs + name: bazel-doltserver-testlogs path: | bazel-testlogs/**/test.log bazel-testlogs/**/test.xml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6fe5e1b8d..72eb4637b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -36,10 +36,11 @@ env: # `proxied-server tier` and `server-Dolt storage tier`). BAZEL_RETIRES_LEGACY_DOLT_SERVER_TIERS: "true" # Step 3: pr.yml's own legacy jobs whose Bazel lanes run in the same pr.yml - # run: PR Core, build-artifacts, the pure-Go/js-wasm check, domain+uow and - # contract corpus (Bazel `test`, `pure-Go and js/wasm`, `dolt-server - # lane`). pr-risk.yml retires nothing for it; its copy only keeps the - # shared bazel-coverage job identical. + # run: PR Core, build-artifacts and the pure-Go/js-wasm check (Bazel + # `test`, `pure-Go and js/wasm`); the `dolt-server lane`, the only run of + # the Dolt-backed domain, uow, tracker, doctor/fix and protocol suites, is + # held to the same rule. pr-risk.yml retires nothing for it; its copy only + # keeps the shared bazel-coverage job identical. BAZEL_RETIRES_LEGACY_PR_LANES: "true" # F4 side-by-side rollout: "false" keeps the native windows-latest jobs # (test-windows-liveness, worktree-remove-windows) as the required pair and @@ -1374,100 +1375,6 @@ jobs: retention-days: 7 if-no-files-found: error - # Focused job for the hexagonal storage layer (internal/storage/domain/* and - # internal/storage/uow). These packages back the proxied-server init path and - # also live behind the existing ./... matrix, but TestDomainDB requires the - # Dolt sql-server image cached locally (testcontainers checks `docker image - # inspect` and skips otherwise). Pulling the image up front guarantees the - # suite actually runs and surfaces failures here with a clear job name. - # - # D2 step 3: stands down where bazel-coverage says pr_lanes; Bazel's - # `dolt-server lane` runs the same packages against a local dolt - # sql-server, and //internal/testutil:testutil_dolt_test checks that - # server against the checked-in fingerprint. Where this job runs, its - # first test step checks the container it uses against the same - # fingerprint, so the two backends cannot drift apart unnoticed. - test-domain-uow: - name: Test (storage domain + uow) - runs-on: ubuntu-latest - needs: [build-artifacts, bazel-coverage] - if: needs.bazel-coverage.outputs.pr_lanes != 'true' - # The race-enabled storage package has outgrown Go's implicit 10-minute - # timeout. Keep both per-package deadlines inside one finite job budget. - timeout-minutes: 35 - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 - - - name: Set up Go - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 - with: - go-version-file: 'go.mod' - cache: false - - - name: Install Dolt CLI - run: ./scripts/ci/install-dolt.sh - - - name: Verify dolt on PATH - run: dolt version - - - name: Configure Git and Dolt identity - run: | - git config --global user.name "CI Bot" - git config --global user.email "ci@beads.test" - dolt config --global --add user.name "CI Bot" - dolt config --global --add user.email "ci@beads.test" - - - name: Pull Dolt sql-server image - # Keep tag in sync with internal/testutil/testdoltcommon.go:DoltDockerImage. - # Without this, RequireDoltContainer reports doltNoImage and TestDomainDB skips. - run: ./scripts/ci/pull-dolt-image.sh - - - name: Download build artifacts - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 - with: - name: ci-build-artifacts - path: ci-build-artifacts - - - name: Verify build artifacts - run: | - set -euo pipefail - cd ci-build-artifacts - sha256sum -c SHA256SUMS - chmod +x bd-linux-gms-pure - - # The container this job's tests use, and the local server (the - # pinned dolt CLI installed above), against the checked-in - # fingerprint. REQUIRE makes the container half fail, not skip. - - name: Test Dolt server fingerprint (container + local) - env: - BEADS_TEST_REQUIRE_DOLT_CONTAINER: "1" - run: go test -tags gms_pure_go -count=1 -timeout 5m -v -run '^TestDoltServerFingerprint$' ./internal/testutil/ - - - name: Test domain + uow + tracker - env: - BEADS_TEST_BD_BINARY: ${{ github.workspace }}/ci-build-artifacts/bd-linux-gms-pure - # internal/storage/domain, internal/storage/uow, and internal/tracker - # run as concurrent package test binaries in this one invocation. - # testcontainers-go shares one Ryuk reaper per host; a failed - # handshake in one process can reap a sibling's live Dolt container - # mid-suite (be-2on). The runner is destroyed after the job, so the - # reaper buys nothing here and only costs this race. - TESTCONTAINERS_RYUK_DISABLED: "true" - run: go test -tags gms_pure_go -race -count=1 -timeout 15m -v ./internal/storage/domain/... ./internal/storage/uow/... ./internal/tracker/... - - # The doctor/fix DB-backed suite spins its own Dolt container in - # TestMain. BEADS_FIX_REQUIRE_DOLT=1 turns a missing container into a - # hard failure so the suite can never silently skip in CI again - # (bd-nxt5e: it was dark for months); this job pulls the image above. - - name: Test doctor/fix (Dolt-backed, hard-require container) - env: - BEADS_TEST_BD_BINARY: ${{ github.workspace }}/ci-build-artifacts/bd-linux-gms-pure - BEADS_FIX_REQUIRE_DOLT: "1" - # Pinned for consistency with the step above: this single-package - # step has no sibling test binary to race for the reaper (be-2on). - TESTCONTAINERS_RYUK_DISABLED: "true" - run: go test -tags gms_pure_go -race -count=1 -timeout 10m -v ./cmd/bd/doctor/fix/ - # `test-macos` / "Test (macos-latest)" used to run here and is deliberately # removed (F4, PR CI -> 5 min). It was a non-required, PR-side mirror of # main.yml's `test` job's macOS leg (full `go test -race -short ./...`), @@ -1488,66 +1395,6 @@ jobs: # they are not a substitute. If this tradeoff turns out to be wrong, # reinstate a PR-side mirror rather than relying on main.yml alone. - # Producer-side guard for the Beads<->consumer CLI contract. Runs the whole - # cmd/bd/protocol package: the golden corpus (regenerated from this branch's - # bd and byte-compared to the committed testdata/corpus/, so an unreviewed - # wire change is a hard failure — run `make corpus-regen`), the double-run - # determinism check, and the TestProtocol_/TestJSONContract_ behavioral - # conformance suite that pins the CLI's JSON payloads and semantics. - # - # Run the PACKAGE, never a -run subset: a filter here is what let the - # conformance tests sit red on main for ~3 months while every CI run was - # green (they matched no job's -run, and every broad ./... job skips them - # for want of a Dolt store). Package scope means a newly added protocol test - # is gated the moment it lands. - # - # Needs the Dolt sql-server image (the protocol harness spins a container). - # ~10 min: each test builds an isolated Dolt-backed workspace. If that ever - # becomes unacceptable on PRs, shard this job by an exhaustive `go test - # -list` partition — do not reintroduce a hand-written -run regex. - # - # D2 step 3: stands down where bazel-coverage says pr_lanes; Bazel's - # `dolt-server lane` runs the package (//cmd/bd/protocol:protocol_dolt_test). - contract-corpus: - name: Contract corpus (golden + determinism + conformance) - runs-on: ubuntu-latest - needs: bazel-coverage - if: needs.bazel-coverage.outputs.pr_lanes != 'true' - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 - - - name: Set up Go - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 - with: - go-version-file: 'go.mod' - cache: false - - - name: Install Dolt CLI - run: ./scripts/ci/install-dolt.sh - - - name: Configure Git and Dolt identity - run: | - git config --global user.name "CI Bot" - git config --global user.email "ci@beads.test" - dolt config --global --add user.name "CI Bot" - dolt config --global --add user.email "ci@beads.test" - - - name: Pull Dolt sql-server image - # Keep tag in sync with internal/testutil/testdoltcommon.go:DoltDockerImage. - run: ./scripts/ci/pull-dolt-image.sh - - - name: Protocol conformance + corpus golden + determinism - # Require a live Dolt store here: this is the gate that must exercise the - # conformance, golden and double-run checks, so a failed container is a - # hard failure, not a silent skip (see requireDoltStore in the - # cmd/bd/protocol tests). - # - # -timeout is explicit because the package runs well past `go test`'s - # 10m default; without it a slow runner reports a panic, not a verdict. - env: - BEADS_PROTOCOL_REQUIRE_DOLT: "1" - run: go test -tags gms_pure_go -count=1 -timeout 30m ./cmd/bd/protocol - # F7a: fold of a 3-host matrix (native, msys2, cygwin) into one sequential # job on a single windows-latest runner. Review SF-1 (2026-10-03): only the # Cygwin *setup* step keeps `continue-on-error: true` (a flaky installer @@ -2085,16 +1932,15 @@ jobs: } # The Bazel lane (bazel.yml), gated alongside the legacy jobs it mirrors - # (PR Core, build-artifacts, the pure-Go/js-wasm check, domain+uow and - # contract corpus, and pr-risk.yml's embedded-Dolt, proxied-server and + # (PR Core, build-artifacts, the pure-Go/js-wasm check, and + # pr-risk.yml's embedded-Dolt, proxied-server and # server-Dolt storage tiers), all of which stay required ids, but stand # down on same-repo PRs with a non-Dependabot actor, and on merge groups, # while their D2 flag is "true" (bazel-coverage): pr-risk.yml's embedded-Dolt test jobs # (BAZEL_RETIRES_LEGACY_EMBEDDED, step 1), its proxied-server and # server-Dolt storage test jobs (BAZEL_RETIRES_LEGACY_DOLT_SERVER_TIERS, - # step 2), and this workflow's PR Core, build-artifacts, pure-Go/js-wasm, - # domain+uow and contract corpus jobs (BAZEL_RETIRES_LEGACY_PR_LANES, - # step 3). ci-gate then requires this call's lanes for them (embedded; + # step 2), and this workflow's PR Core, build-artifacts and pure-Go/js-wasm + # jobs (BAZEL_RETIRES_LEGACY_PR_LANES, step 3). ci-gate then requires this call's lanes for them (embedded; # proxied and server-storage; test, pure and doltserver) to have run # remotely and passed. bazel.yml has no pull_request/merge_group trigger # of its own: this call is its only PR run. It gets the four RBE secrets @@ -2135,9 +1981,9 @@ jobs: # D2: pr-risk.yml's bazel-coverage job, verbatim (policy-tested # identical). Where it says a tier is covered, PR Risk skips that tier's # legacy test jobs (embedded, dolt_server), or this workflow skips its own - # (pr_lanes: build-artifacts, PR Core, the pure-Go/js-wasm check, - # domain+uow and contract corpus), so ci-gate requires the tier's Bazel - # lanes to have run remotely and passed in this run. + # (pr_lanes: build-artifacts, PR Core, the pure-Go/js-wasm check), so + # ci-gate requires the tier's Bazel lanes to have run remotely and passed + # in this run. bazel-coverage: name: Bazel tier coverage # F3: same-repo PRs and merge_group get the org's Blacksmith pool; forks, @@ -2245,8 +2091,6 @@ jobs: - pr-core-wrapper - scripts-go-checks - pr-lint-wrapper - - test-domain-uow - - contract-corpus - windows-make-shell - bazel - bazel-coverage @@ -2271,8 +2115,6 @@ jobs: PR_CORE_WRAPPER SCRIPTS_GO_CHECKS PR_LINT_WRAPPER - TEST_DOMAIN_UOW - CONTRACT_CORPUS WINDOWS_MAKE_SHELL BAZEL BAZEL_TEST @@ -2322,8 +2164,6 @@ jobs: PR_CORE_WRAPPER: ${{ needs.pr-core-wrapper.result }} SCRIPTS_GO_CHECKS: ${{ needs.scripts-go-checks.result }} PR_LINT_WRAPPER: ${{ needs.pr-lint-wrapper.result }} - TEST_DOMAIN_UOW: ${{ needs.test-domain-uow.result }} - CONTRACT_CORPUS: ${{ needs.contract-corpus.result }} WINDOWS_MAKE_SHELL: ${{ needs.windows-make-shell.result }} # bazel.yml's lanes report their job.status as outputs; a lane that # did not report (skipped, or lost before its last step) reads as @@ -2387,7 +2227,7 @@ jobs: # bazel-coverage says pr_lanes (exactly "true"); their Bazel lanes # are then required below. if [[ "$BAZEL_COVERS_PR_LANES" == "true" ]]; then - skipped_ok="$skipped_ok BUILD_ARTIFACTS CHECK_CMD_BD_PUREGEO_TESTS PR_CORE_WRAPPER TEST_DOMAIN_UOW CONTRACT_CORPUS" + skipped_ok="$skipped_ok BUILD_ARTIFACTS CHECK_CMD_BD_PUREGEO_TESTS PR_CORE_WRAPPER" fi # Where a legacy tier is retired (by PR Risk or by this # workflow), this run's Bazel lanes for it are the tier's only @@ -2415,6 +2255,6 @@ jobs: } retired BAZEL_EMBEDDED_RETIRED BAZEL_RETIRES_LEGACY_EMBEDDED "$BAZEL_COVERS_EMBEDDED" "PR Risk embedded Dolt tier" BAZEL_EMBEDDED retired BAZEL_DOLT_SERVER_RETIRED BAZEL_RETIRES_LEGACY_DOLT_SERVER_TIERS "$BAZEL_COVERS_DOLT_SERVER" "PR Risk proxied-server and server-Dolt storage tiers" BAZEL_PROXIED BAZEL_SERVER_STORAGE - retired BAZEL_PR_LANES_RETIRED BAZEL_RETIRES_LEGACY_PR_LANES "$BAZEL_COVERS_PR_LANES" "PR Core, build-artifacts, pure-Go/js-wasm, domain+uow and contract corpus jobs" BAZEL_TEST BAZEL_PURE BAZEL_DOLTSERVER + retired BAZEL_PR_LANES_RETIRED BAZEL_RETIRES_LEGACY_PR_LANES "$BAZEL_COVERS_PR_LANES" "PR Core, build-artifacts and pure-Go/js-wasm jobs (and the dolt-server lane)" BAZEL_TEST BAZEL_PURE BAZEL_DOLTSERVER export CI_GATE_SKIPPED_OK="$skipped_ok" bash .github/scripts/ci-gate.sh diff --git a/cmd/bd/doctor/fix/BUILD.bazel b/cmd/bd/doctor/fix/BUILD.bazel index adc25eb0a..af5e6d02b 100644 --- a/cmd/bd/doctor/fix/BUILD.bazel +++ b/cmd/bd/doctor/fix/BUILD.bazel @@ -97,41 +97,12 @@ go_test( ], ) -# The Dolt-backed half of fix_test, as pr.yml's "Test doctor/fix (Dolt-backed, -# hard-require container)" job runs it: TestMain starts a dolt sql-server -# container through testcontainers, and BEADS_FIX_REQUIRE_DOLT=1 turns a -# missing container into a failure instead of a silent skip. fix_test itself -# stays untagged: under --config=prcore (BEADS_TEST_SKIP=dolt, like pr-core's -# `go test`) it never touches docker and runs anywhere. -# -# Tags: -# requires-docker: needs a docker daemon; excluded from --config=prcore/ci, -# selected by --config=docker. -# no-remote-exec: the daemon is on the host, not on remote workers. -sh_test( - name = "fix_docker_test", - size = "large", - srcs = ["//tools/bazel:go_test_variant.sh"], - args = ["$(rootpath :fix_test)"], - data = [":fix_test"], - # Pinned to the container backend (the docker lane is the A/B control); - # rule env beats --test_env, so =local on the command line cannot flip it. - env = { - "BEADS_FIX_REQUIRE_DOLT": "1", - "BEADS_TEST_DOLT_SERVER": "container", - }, - tags = [ - "no-remote-exec", - "requires-docker", - ], -) - -# The Dolt-backed half of fix_test, as pr.yml's "Test doctor/fix (Dolt-backed, -# hard-require container)" step runs it, on the dolt-server lane: TestMain's -# server is a local `dolt sql-server` child of the test process, and -# BEADS_FIX_REQUIRE_DOLT=1 keeps the suite from skipping when it cannot start. -# fix_docker_test is the A/B control. 4 shards: unsharded it was the lane's -# critical path (~4 min remotely). +# The Dolt-backed half of fix_test, as the retired "Test doctor/fix +# (Dolt-backed, hard-require container)" step ran it, on the dolt-server +# lane: TestMain's server is a local `dolt sql-server` child of the test +# process, and BEADS_FIX_REQUIRE_DOLT=1 keeps the suite from skipping when it +# cannot start. +# 4 shards: unsharded it was the lane's critical path (~4 min remotely). # # Tags: # dolt-server: starts hermetic dolt sql-servers from the pinned dolt in the diff --git a/cmd/bd/protocol/BUILD.bazel b/cmd/bd/protocol/BUILD.bazel index fe4310f4c..04a4c35b6 100644 --- a/cmd/bd/protocol/BUILD.bazel +++ b/cmd/bd/protocol/BUILD.bazel @@ -53,67 +53,32 @@ go_test( ], ) -# protocol_test without the race detector, which --config=docker otherwise -# turns on for every target: pr.yml's "Contract corpus" job runs +# protocol_test without the race detector, which --config=doltserver +# otherwise turns on for every target: the contract corpus has always run # `go test ./cmd/bd/protocol` without -race (PR Core covers the race build). # Matching it is cheap: tools/bazel/race.bzl lands protocol_test's deps in # the configuration the non-race //cmd/bd:bd_for_tests already builds them in, # so the extra work is protocol_test's test-only libraries and one link. # Racing it instead would also be acceptable (a race-only failure is a real -# bug); then drop this target and point protocol_docker_test back at +# bug); then drop this target and point protocol_dolt_test back at # :protocol_test. # # Tags: -# manual: only protocol_docker_test's input, never a build target of its +# manual: only protocol_dolt_test's input, never a build target of its # own. `bazel test //...` in every lane still builds it through -# protocol_docker_test (a test tag filter does not stop the build). +# protocol_dolt_test (a test tag filter does not stop the build). go_test_race_off( name = "protocol_race_off", tags = ["manual"], test = ":protocol_test", ) -# protocol_test as pr.yml's "Contract corpus" job runs it: non-race, TestMain -# starts a dolt sql-server container and BEADS_PROTOCOL_REQUIRE_DOLT=1 turns a -# missing container into a failure instead of a skip. It repeats -# protocol_test's `env` (go_test_variant.sh cannot inherit it). protocol_test -# itself stays untagged: under --config=prcore (BEADS_TEST_SKIP=dolt) its -# Dolt-backed tests skip. -# -# Tags: -# requires-docker: needs a docker daemon; excluded from --config=prcore/ci, -# selected by --config=docker. -# no-remote-exec: the daemon is on the host, not on remote workers. -sh_test( - name = "protocol_docker_test", - size = "large", - srcs = ["//tools/bazel:go_test_variant.sh"], - args = ["$(rootpath :protocol_race_off)"], - data = [ - ":protocol_race_off", - "//cmd/bd:bd_for_tests", - ], - # Pinned to the container backend (the docker lane is the A/B control); - # rule env beats --test_env, so =local on the command line cannot flip it. - env = { - "BEADS_PROTOCOL_REQUIRE_DOLT": "1", - "BEADS_TEST_BD_BINARY": "$(rlocationpath //cmd/bd:bd_for_tests)", - "BEADS_TEST_DOLT_SERVER": "container", - }, - # ~10 min unsharded without -race in pr.yml. - shard_count = 8, - tags = [ - "no-remote-exec", - "requires-docker", - ], -) - -# protocol_test as pr.yml's "Contract corpus" job runs it (non-race, like the -# job; see protocol_race_off), on the dolt-server lane: TestMain's server is a +# protocol_test as the retired "Contract corpus" job ran it (non-race, like +# the job; see protocol_race_off), on the dolt-server lane: TestMain's server is a # local `dolt sql-server` child of the test process, and # BEADS_PROTOCOL_REQUIRE_DOLT=1 turns a server that cannot start into a # failure, so the golden and double-run determinism tests cannot skip. It -# repeats protocol_test's `env`. protocol_docker_test is the A/B control. +# repeats protocol_test's `env`. # # Tags: # dolt-server: starts hermetic dolt sql-servers from the pinned dolt in the diff --git a/engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md b/engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md index d879d6c8e..d78878efc 100644 --- a/engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md +++ b/engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md @@ -645,9 +645,7 @@ Do not require these existing check names directly: the former `test-windows-doltversion` and `test-windows-dbproxy-server`) - `Test (ubuntu-latest)` - `Test (macos-latest)` -- `Test (storage domain + uow)` - `Go checks (vet)` -- `Contract corpus (golden + determinism + conformance)` - `PR Core (wrapper timing)` - `Build Artifacts` - `Bazel tier coverage` @@ -790,9 +788,9 @@ intentionally absent for that event or risk tier: `TEST_SERVER_STORAGE_FULL` when it reported `dolt_server=true`; and `BUILD_EMBEDDED` when it reported both. `BAZEL_COVERAGE` (that job's result) must be `success`. -- In the baseline aggregate, `BUILD_ARTIFACTS`, `PR_CORE_WRAPPER`, - `CHECK_CMD_BD_PUREGEO_TESTS`, `TEST_DOMAIN_UOW` and `CONTRACT_CORPUS` may - be `skipped` when `bazel-coverage` reported `pr_lanes=true`. +- In the baseline aggregate, `BUILD_ARTIFACTS`, `PR_CORE_WRAPPER` and + `CHECK_CMD_BD_PUREGEO_TESTS` may be `skipped` when `bazel-coverage` + reported `pr_lanes=true`. - In the baseline aggregate, `BAZEL_COVERAGE` must be `success`; `BAZEL_EMBEDDED_RETIRED` is red when `embedded=true` but the Bazel embedded lane did not run remotely and pass, `BAZEL_DOLT_SERVER_RETIRED` when @@ -870,7 +868,7 @@ D2 retires legacy test jobs on same-repo PRs, one step at a time, where | --- | --- | --- | --- | --- | | 1 | `test-embedded-storage` x5, `test-embedded-conformance` x2, `test-embedded-cmd` x20 | `bazel-embedded` (`--config=embedded`) | `BAZEL_RETIRES_LEGACY_EMBEDDED` | `BAZEL_EMBEDDED_RETIRED` | | 2 | `test-proxied-cmd` x15, `test-server-storage`, `test-server-storage-full` x16 | `bazel-proxied` (`--config=doltserver-proxied`), `bazel-server-storage` (`--config=doltserver-integration`) | `BAZEL_RETIRES_LEGACY_DOLT_SERVER_TIERS` | `BAZEL_DOLT_SERVER_RETIRED` | -| 3 | `pr.yml`: `pr-core-wrapper` (PR Core), `build-artifacts`, `check-cmd-bd-puregeo-tests` (pure-Go and js/wasm), `test-domain-uow`, `contract-corpus` | `bazel-test` (`--config=ci`, which also publishes `bazel-ci-build-artifacts`), `bazel-pure` (`--config=pure`, `--config=js-wasm`), `bazel-doltserver` (`--config=doltserver`) | `BAZEL_RETIRES_LEGACY_PR_LANES` | `BAZEL_PR_LANES_RETIRED` | +| 3 | `pr.yml`: `pr-core-wrapper` (PR Core), `build-artifacts`, `check-cmd-bd-puregeo-tests` (pure-Go and js/wasm) | `bazel-test` (`--config=ci`, which also publishes `bazel-ci-build-artifacts`), `bazel-pure` (`--config=pure`, `--config=js-wasm`), `bazel-doltserver` (`--config=doltserver`; the only run of the former `test-domain-uow` and `contract-corpus` suites) | `BAZEL_RETIRES_LEGACY_PR_LANES` | `BAZEL_PR_LANES_RETIRED` | @@ -882,16 +880,15 @@ manifests. On those PRs they are the tiers' only pre-merge run, and - Step 3 specifics (`pr.yml`'s own jobs, so the legacy jobs and their Bazel lanes run in the same `pr.yml` run): - - The five jobs add `needs: bazel-coverage` and + - The three jobs add `needs: bazel-coverage` and `if: needs.bazel-coverage.outputs.pr_lanes != 'true'`; `pr.yml`'s gate accepts their skips only when `pr_lanes` is exactly `true`, and then requires `BAZEL_TEST`, `BAZEL_PURE` and `BAZEL_DOLTSERVER` to have run remotely and passed (`BAZEL_PR_LANES_RETIRED`). `pr-risk.yml` commits the flag too, only so the shared `bazel-coverage` job stays identical; nothing in PR Risk reads `pr_lanes`. - - Artifact consumers: `build-artifacts`' `ci-build-artifacts` fed PR Core, - domain+uow and (before F3) the package gates; all three now stand down - with it. No other job in any workflow reads `pr.yml`'s artifacts + - Artifact consumers: `build-artifacts`' `ci-build-artifacts` feeds PR + Core, which stands down with it. No other job in any workflow reads `pr.yml`'s artifacts (`docs-autofix.yml` reads `check-doc-flags`' `cli-docs-freshness-patch`, which is unaffected). - F3: the package gates (`package-mcp`, `package-npm`) moved into @@ -914,15 +911,14 @@ manifests. On those PRs they are the tiers' only pre-merge run, and timing measured there), `ubuntu-latest` otherwise. `bazel-test`'s own `bazel-ci-build-artifacts` upload is no longer consumed by anything; it is kept for the F3.5.3 SHA256SUMS comparison and for debugging. - - The Dolt server fingerprint is checked per backend, where that backend - runs. The local server (the pinned dolt CLI every Bazel dolt-server lane - starts) is checked by `//internal/testutil:testutil_dolt_test` on the - dolt-server lane. The container is checked by `test-domain-uow`'s first - test step, which runs only where the container-backed jobs run (not - covered by `pr_lanes`). The every-PR job `test-dolt-server-fingerprint` - (`Test (Dolt server fingerprint)`, `TEST_DOLT_SERVER_FINGERPRINT`) - pulled a docker image the workers do not have, so it is retired; the - image tag stays pinned to the dolt release by + - The Dolt-backed domain, uow, tracker, doctor/fix and protocol suites + run only on the dolt-server lane, against hermetic `dolt sql-server`s + started from the pinned dolt; no CI job runs them against the + testcontainers backend (no `requires-docker` targets, no + `--config=docker`). The Dolt server fingerprint is checked in CI on that + local backend by `//internal/testutil:testutil_dolt_test`; its container + half runs under plain `go test` wherever docker and the image are + present, and the image tag stays pinned to the dolt release by `TestPinnedDoltCLIMatchesContainerImage`. The release-target cross-compilation (formerly pr.yml's `check-release-target-cross-compilation`, `go build ./...` with @@ -1099,8 +1095,8 @@ manifests. On those PRs they are the tiers' only pre-merge run, and legacy `-test.count=1` jobs). Since merge queue readiness these lanes cache results like every other lane, and nightly's `--config=fresh` re-executes every test once a day (see [Merge Queue](#merge-queue), - "Test result caching"). Only `test:docker` and `test:fresh` set result - caching in `.bazelrc`. + "Test result caching"). Only `test:fresh` sets result caching in + `.bazelrc`. - No retries: no `--flaky_test_attempts` or `--runs_per_test_detects_flakes` anywhere, and no `flaky =` other than a literal `False`. Each lane also runs @@ -1509,9 +1505,7 @@ retired tiers' configs and `sole-run`, parity with the legacy results, so nothing could ever be reused. Why caching is safe: - A cached PASS is valid for identical inputs: these targets are hermetic - (dolt and every input are runfiles). The docker-backed lane, whose - result depends on host state outside the key, keeps - `--nocache_test_results` and is dispatch-only. + (dolt and every input are runfiles). - A cached failure is never reused: Bazel treats a failed cached action as a miss, so whatever failed before runs again. - Poisoning is bounded: only rbe-west's workers write the action cache diff --git a/engdocs/TESTING.md b/engdocs/TESTING.md index c4970caef..bffa77fc5 100644 --- a/engdocs/TESTING.md +++ b/engdocs/TESTING.md @@ -103,10 +103,10 @@ same for the proxied subtests that bridge an external endpoint with `socat` sets it, and the legacy GitHub proxied jobs, which have no `socat`, do not. Under Bazel, `bazel test //... --config=doltserver` runs the Dolt-backed -suites of pr.yml's "Test (storage domain + uow)" and "Contract corpus" jobs -on the `local` backend (the `dolt-server` targets); they need no docker and -execute remotely with `--config=remote-exec`. `--config=docker` runs the same -suites on the `container` backend (host docker) as the A/B control. +domain, uow, tracker, doctor/fix, protocol and testutil suites on the `local` +backend (the `dolt-server` targets); they need no docker and execute +remotely with `--config=remote-exec`. No Bazel target uses the `container` +backend; run `go test` with docker and the pulled image to exercise it. PR Risk's heavier server tiers have configs of their own, run by bazel.yml only with remote execution, each in a job of its own (`bazel-proxied`, `bazel-server-storage`): `--config=doltserver-proxied` is the diff --git a/internal/storage/domain/db/BUILD.bazel b/internal/storage/domain/db/BUILD.bazel index 7498f62cf..823ed995a 100644 --- a/internal/storage/domain/db/BUILD.bazel +++ b/internal/storage/domain/db/BUILD.bazel @@ -126,40 +126,11 @@ go_test( ], ) -# The Dolt-backed db suite (TestDomainDB) as pr.yml's "Test (storage domain + -# uow)" job runs it: the suite starts a dolt sql-server container through -# testcontainers, and BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 turns a missing -# container into a failure instead of a silent skip. db_test itself stays -# untagged: under --config=prcore (BEADS_TEST_SKIP=dolt) the suite skips, as in -# pr-core's `go test`. -# -# Tags: -# requires-docker: needs a docker daemon; excluded from --config=prcore/ci, -# selected by --config=docker. -# no-remote-exec: the daemon is on the host, not on remote workers. -sh_test( - name = "db_docker_test", - size = "large", - srcs = ["//tools/bazel:go_test_variant.sh"], - args = ["$(rootpath :db_test)"], - data = [":db_test"], - # Pinned to the container backend (the docker lane is the A/B control); - # rule env beats --test_env, so =local on the command line cannot flip it. - env = { - "BEADS_TEST_DOLT_SERVER": "container", - "BEADS_TEST_REQUIRE_DOLT_CONTAINER": "1", - }, - tags = [ - "no-remote-exec", - "requires-docker", - ], -) - -# db_test as pr.yml's "Test (storage domain + uow)" job runs it, on the +# db_test as the retired "Test (storage domain + uow)" job ran it, on the # dolt-server lane: TestDomainDB's server is a `dolt sql-server` the test # process starts itself (the local backend of internal/testutil) instead of a # testcontainers container. GOMAXPROCS=4 is the job's runner shape (the -# executor may have far more cores). db_docker_test is the A/B control. +# executor may have far more cores). # # Tags: # dolt-server: starts hermetic dolt sql-servers from the pinned dolt in the diff --git a/internal/storage/uow/BUILD.bazel b/internal/storage/uow/BUILD.bazel index ffcd8cf28..d98cfcc61 100644 --- a/internal/storage/uow/BUILD.bazel +++ b/internal/storage/uow/BUILD.bazel @@ -86,7 +86,7 @@ go_library( # ~6-8s apiece, and the package needs ~7 min serially (TestBatchApplyContract # alone ~1 min: BoundsTheItemCount applies 1000+1001 real items), past the # default medium 300s. size/shard_count cover that configless run, the same -# workload uow_dolt_test (8 shards) and uow_docker_test (4 shards) run. +# workload uow_dolt_test (8 shards) runs. go_test( name = "uow_test", size = "large", @@ -202,45 +202,11 @@ go_test( ], ) -# The container-backed uow tests as pr.yml's "Test (storage domain + uow)" job -# runs them (no -short; each test starts its own dolt sql-server container), -# with BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 so a missing container fails instead -# of skipping. It repeats uow_test's `env` (go_test_variant.sh cannot inherit -# it). uow_test itself stays untagged: under --config=prcore those tests skip. -# -# Tags: -# requires-docker: needs a docker daemon; excluded from --config=prcore/ci, -# selected by --config=docker. -# no-remote-exec: the daemon is on the host, not on remote workers. -sh_test( - name = "uow_docker_test", - size = "large", - srcs = ["//tools/bazel:go_test_variant.sh"], - args = ["$(rootpath :uow_test)"], - data = [ - ":uow_test", - "//cmd/bd:bd_for_tests", - ], - # Pinned to the container backend (the docker lane is the A/B control); - # rule env beats --test_env, so =local on the command line cannot flip it. - env = { - "BEADS_TEST_BD_BINARY": "$(rlocationpath //cmd/bd:bd_for_tests)", - "BEADS_TEST_DOLT_SERVER": "container", - "BEADS_TEST_REQUIRE_DOLT_CONTAINER": "1", - }, - # ~12 min unsharded under -race on a loaded host (large allows 15). - shard_count = 4, - tags = [ - "no-remote-exec", - "requires-docker", - ], -) - -# uow_test as pr.yml's "Test (storage domain + uow)" job runs it (no -short), +# uow_test as the retired "Test (storage domain + uow)" job ran it (no -short), # on the dolt-server lane: every server the tests ask internal/testutil for is # a `dolt sql-server` child of the test process, so the target runs on remote # workers. It repeats uow_test's `env` (go_test_variant.sh cannot inherit it). -# GOMAXPROCS=4 is the job's runner shape. uow_docker_test is the A/B control. +# GOMAXPROCS=4 is the job's runner shape. # 8 shards keep each under ~2 min remotely (the package is ~7 min in the job). # # Tags: diff --git a/internal/testutil/BUILD.bazel b/internal/testutil/BUILD.bazel index c3ecd1843..5fef41c5a 100644 --- a/internal/testutil/BUILD.bazel +++ b/internal/testutil/BUILD.bazel @@ -132,9 +132,10 @@ go_test( # server fingerprint)" job, every PR) and the TestLocalDoltServer_* tests run # against the pinned dolt in the test wrapper's runfiles. Every other # configuration of testutil_test passes BEADS_TEST_SKIP=dolt and skips them. -# The container half needs docker: testutil_docker_test below runs it on the -# docker lane, and TestPinnedDoltCLIMatchesContainerImage (//scripts) keeps -# the image tag on the pinned release. +# The container half needs docker and the image, so no Bazel target runs it: +# it runs under plain `go test` (the container backend is the default there) +# on a host that has both, and TestPinnedDoltCLIMatchesContainerImage +# (//scripts) keeps the image tag on the pinned release. # # Tags: # dolt-server: starts hermetic dolt sql-servers from the pinned dolt in the @@ -153,30 +154,6 @@ sh_test( tags = ["dolt-server"], ) -# The same tests with the container backend selected and required: the A/B -# control for testutil_dolt_test, and the only place TestDoltServerFingerprint's -# container half runs in CI (bazel.yml's docker lane, dolt-lane=docker). -# -# Tags: -# requires-docker: needs a docker daemon and the cached dolt-sql-server -# image; selected by --config=docker. -# no-remote-exec: the docker lane runs on the host. -sh_test( - name = "testutil_docker_test", - size = "medium", - srcs = ["//tools/bazel:go_test_variant.sh"], - args = ["$(rootpath :testutil_test)"], - data = [":testutil_test"], - env = { - "BEADS_TEST_DOLT_SERVER": "container", - "BEADS_TEST_REQUIRE_DOLT_CONTAINER": "1", - }, - tags = [ - "no-remote-exec", - "requires-docker", - ], -) - # --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- filegroup( diff --git a/internal/tracker/BUILD.bazel b/internal/tracker/BUILD.bazel index 491df98bd..1fb51af6d 100644 --- a/internal/tracker/BUILD.bazel +++ b/internal/tracker/BUILD.bazel @@ -60,34 +60,11 @@ go_test( ], ) -# tracker_test as pr.yml's "Test (storage domain + uow)" job runs it: no -# -short and no BEADS_TEST_SKIP=dolt, so TestMain starts the shared dolt -# sql-server container, and BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 turns a missing -# container into a failure instead of a suite of skips. tracker_test itself -# stays untagged: under --config=prcore its Dolt-backed tests skip. -# -# Tags: -# requires-docker: needs a docker daemon; excluded from --config=prcore/ci, -# selected by --config=docker. -# no-remote-exec: the daemon is on the host, not on remote workers. -sh_test( - name = "tracker_docker_test", - size = "large", - srcs = ["//tools/bazel:go_test_variant.sh"], - args = ["$(rootpath :tracker_test)"], - data = [":tracker_test"], - env = {"BEADS_TEST_REQUIRE_DOLT_CONTAINER": "1"}, - tags = [ - "no-remote-exec", - "requires-docker", - ], -) - -# tracker_test as pr.yml's "Test (storage domain + uow)" job runs it (no +# tracker_test as the retired "Test (storage domain + uow)" job ran it (no # -short; TestMain starts the shared server), on the dolt-server lane: the # server is a local `dolt sql-server` child of the test process. # BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 makes TestMain exit 1 if it cannot start, -# instead of WARN-skipping the suite. tracker_docker_test is the A/B control. +# instead of WARN-skipping the suite. # # Tags: # dolt-server: starts hermetic dolt sql-servers from the pinned dolt in the diff --git a/scripts/bazel_policy_test.go b/scripts/bazel_policy_test.go index edcd54ee7..8a0d2516e 100644 --- a/scripts/bazel_policy_test.go +++ b/scripts/bazel_policy_test.go @@ -826,7 +826,6 @@ var allowedBazelTestTags = map[string]string{ "host-tools": "needs host tools (bash/git/make/jq/...) beyond the test wrapper's", "no-remote-exec": "must run on the Bazel client's host, never on a remote worker", "no-remote-cache": "result depends on the host, so it is neither read from nor uploaded to the remote cache", - "requires-docker": "needs a docker daemon; excluded from --config=prcore/ci, run by --config=docker", // No no-remote-exec: the target starts its own dolt sql-server from the // pinned dolt in its runfiles, so it runs on any worker, and a server that // cannot start fails it rather than skipping, so its cached result holds. @@ -866,7 +865,7 @@ var allowedBazelTestTags = map[string]string{ // and vice versa (TestBazelPRCoreExcludedTagsMatchTaxonomy), so a new lane // tag lands here, and through bazelIntegrationExcludedTags in the // integration lane's filter too. -var bazelPRCoreExcludedTags = []string{"requires-docker", "dolt-server", "dolt-server-proxied", "dolt-server-integration", "dolt-server-cmd", "embedded", "manual", "integration-only"} +var bazelPRCoreExcludedTags = []string{"dolt-server", "dolt-server-proxied", "dolt-server-integration", "dolt-server-cmd", "embedded", "manual", "integration-only"} // bazelIntegrationRunsTags are the PR-core-excluded tags --config=integration // runs: the integration lane is main.yml's integration jobs, whose @@ -914,12 +913,9 @@ func TestBazelPRCoreExcludedTagsMatchTaxonomy(t *testing.T) { // they must also carry: no-remote-exec, or remote execution would run them on a // worker that lacks the tool or daemon; and for host-tools, no-remote-cache, // because the action key does not cover the host's tool inventory, so a result -// produced on one host must not be served to another. (requires-docker -// targets fail rather than skip without their daemon, so their passes are -// safe to share.) +// produced on one host must not be served to another. var bazelTagsRequiring = map[string][]string{ - "host-tools": {"no-remote-exec", "no-remote-cache"}, - "requires-docker": {"no-remote-exec"}, + "host-tools": {"no-remote-exec", "no-remote-cache"}, } var ( @@ -994,8 +990,8 @@ func checkBazelBuildTags(name, build string) []error { func TestBazelTestTagsFollowTaxonomy(t *testing.T) { for name, good := range map[string]string{ - "docker": "# Tags:\n# requires-docker: needs a daemon.\n# no-remote-exec: the daemon is local.\n" + - "sh_test(\n name = \"x\",\n tags = [\n \"no-remote-exec\",\n \"requires-docker\",\n ],\n)\n", + "multi-line": "# Tags:\n# dolt-server: hermetic servers.\n# manual: a build input.\n" + + "sh_test(\n name = \"x\",\n tags = [\n \"dolt-server\",\n \"manual\",\n ],\n)\n", "host-tools": "# host-tools, no-remote-exec, no-remote-cache: git.\n" + "go_test(\n name = \"x\",\n tags = [\"host-tools\", \"no-remote-exec\", \"no-remote-cache\"], # why\n)\n", } { @@ -1008,7 +1004,7 @@ func TestBazelTestTagsFollowTaxonomy(t *testing.T) { "no comment": "go_test(\n name = \"x\",\n tags = [\"manual\"],\n)\n", "comment too far": "# manual: harness\n\ngo_test(\n name = \"x\",\n tags = [\"manual\"],\n)\n", "other rule's": "# manual: harness\ngo_test(name = \"a\", tags = [\"manual\"])\n\ngo_test(\n name = \"b\",\n tags = [\"manual\"],\n)\n", - "docker unpinned": "# requires-docker: daemon\ngo_test(\n name = \"x\",\n tags = [\"requires-docker\"],\n)\n", + "docker tag": "# requires-docker, no-remote-exec: daemon\ngo_test(\n name = \"x\",\n tags = [\"requires-docker\", \"no-remote-exec\"],\n)\n", "not a literal": "# manual\ngo_test(\n name = \"x\",\n tags = MANUAL,\n)\n", "literal plus": "# manual\ngo_test(\n name = \"x\",\n tags = [\"manual\"] + MORE,\n)\n", "host cacheable": "# host-tools no-remote-exec\ngo_test(\n name = \"x\",\n tags = [\"host-tools\", \"no-remote-exec\"],\n)\n", @@ -1159,13 +1155,13 @@ func TestBazelrcPrcoreExcludesNonPRTags(t *testing.T) { } for name, rc := range map[string]string{ "missing": "test:ci --keep_going\n", - "no docker": "test:prcore --test_tag_filters=-dolt-server,-embedded,-manual\n", - "no dolt-server": "test:prcore --test_tag_filters=-requires-docker,-embedded,-manual\n", - "ci override": "test:prcore --test_tag_filters=-requires-docker,-embedded,-manual\n" + - "test:ci --config=prcore\ntest:ci --test_tag_filters=requires-docker\n", - "second prcore line": "test:prcore --test_tag_filters=-requires-docker,-embedded,-manual\n" + + "no embedded": "test:prcore --test_tag_filters=-dolt-server,-manual\n", + "no dolt-server": "test:prcore --test_tag_filters=-embedded,-manual\n", + "ci override": "test:prcore --test_tag_filters=-dolt-server,-embedded,-manual\n" + + "test:ci --config=prcore\ntest:ci --test_tag_filters=dolt-server\n", + "second prcore line": "test:prcore --test_tag_filters=-dolt-server,-embedded,-manual\n" + "test:prcore --test_tag_filters=-manual\n", - "transitive": "test:prcore --test_tag_filters=-requires-docker,-embedded,-manual\n" + + "transitive": "test:prcore --test_tag_filters=-dolt-server,-embedded,-manual\n" + "test:ci --config=prcore\nbuild:nightly --config ci --test_tag_filters=\n", } { if err := checkBazelrcPrcoreTagFilter(rc); err == nil { @@ -1206,23 +1202,16 @@ func TestBazelrcPrcoreMatchesPRCoreParallel(t *testing.T) { t.Fatalf(".bazelrc lacks %q (pr-core.sh runs go test -parallel %s)", want, m[1]) } -// Docker-lane results depend on host state no action key sees (daemon, dolt -// image, network), so they must always execute, like the container jobs' -// -count=1; and no remote-exec run may upload a locally executed result to -// the shared cache. -func TestBazelrcDockerLaneNeverCached(t *testing.T) { - lines := map[string]bool{} +// No remote-exec run may upload a locally executed result (a no-remote-exec +// test's, which depends on the host) to the shared cache. +func TestBazelrcRemoteExecUploadsNoLocalResults(t *testing.T) { + const want = "build:remote-exec --noremote_upload_local_results" for _, line := range strings.Split(readPolicyFile(t, bazelPolicyRoot(t), ".bazelrc"), "\n") { - lines[strings.TrimSpace(line)] = true - } - for _, want := range []string{ - "test:docker --nocache_test_results", - "build:remote-exec --noremote_upload_local_results", - } { - if !lines[want] { - t.Errorf(".bazelrc lacks %q", want) + if strings.TrimSpace(line) == want { + return } } + t.Errorf(".bazelrc lacks %q", want) } // --- fork cache -------------------------------------------------------------- diff --git a/scripts/ci_merge_queue_test.go b/scripts/ci_merge_queue_test.go index 89ebd3532..47de8d20f 100644 --- a/scripts/ci_merge_queue_test.go +++ b/scripts/ci_merge_queue_test.go @@ -311,8 +311,7 @@ func TestMergeQueueBazelCoversRetiredTiers(t *testing.T) { // workflow-level env, --config=fresh only when inputs.fresh-test-results is // true (nightly.yml passes it; nothing else does), appended after every // other --config of each `bazel test` so its --nocache_test_results wins; -// no lane config turns caching off except docker (host state outside the -// action key); and nothing adds retries (eviction retries stay 0 where +// no lane config turns caching off; and nothing adds retries (eviction retries stay 0 where // set, TestBazelRetiredLanesArePinned / TestBazelPRLanesArePinned). func TestBazelTestResultCachingPolicy(t *testing.T) { var doc struct { @@ -412,16 +411,13 @@ func TestBazelTestResultCachingPolicy(t *testing.T) { if strings.HasSuffix(head, ":fresh") { lines = append(lines, line) } - if strings.Contains(line, "cache_test_results") && line != bazelFreshRCLine && line != "test:docker --nocache_test_results" { - t.Errorf(".bazelrc %q: only test:docker and test:fresh set test result caching", line) + if strings.Contains(line, "cache_test_results") && line != bazelFreshRCLine { + t.Errorf(".bazelrc %q: only test:fresh sets test result caching", line) } } if strings.Join(lines, "\n") != bazelFreshRCLine { t.Errorf(".bazelrc --config=fresh = %q, want exactly %q", lines, bazelFreshRCLine) } - if !strings.Contains(rc, "\ntest:docker --nocache_test_results\n") { - t.Error(".bazelrc lost test:docker --nocache_test_results") - } } // detect-package-gates.sh on merge_group diffs the queue's own bounds diff --git a/scripts/ci_workflow_test.go b/scripts/ci_workflow_test.go index e8ce12ca1..dc78cf55a 100644 --- a/scripts/ci_workflow_test.go +++ b/scripts/ci_workflow_test.go @@ -996,62 +996,6 @@ func TestPRCIGateRequiresGeneratedHookTimeoutProcessBoundary(t *testing.T) { } } -func TestStorageDomainUOWJobsUseNestedTimeoutBudgets(t *testing.T) { - const ( - fingerprintTimeoutMinutes = 5 - storageTimeoutMinutes = 15 - doctorTimeoutMinutes = 10 - setupTeardownSlackMinutes = 5 - jobTimeoutMinutes = fingerprintTimeoutMinutes + storageTimeoutMinutes + doctorTimeoutMinutes + setupTeardownSlackMinutes - ) - storageCommand := fmt.Sprintf( - "go test -tags gms_pure_go -race -count=1 -timeout %dm -v ./internal/storage/domain/... ./internal/storage/uow/... ./internal/tracker/...", - storageTimeoutMinutes) - doctorCommand := fmt.Sprintf( - "go test -tags gms_pure_go -race -count=1 -timeout %dm -v ./cmd/bd/doctor/fix/", - doctorTimeoutMinutes) - - for _, workflowName := range []string{"pr.yml"} { - t.Run(workflowName, func(t *testing.T) { - job := readCIWorkflow(t, workflowName).job(t, "test-domain-uow") - if job.TimeoutMinutes != jobTimeoutMinutes { - t.Errorf("test-domain-uow timeout = %d minutes, want %d", job.TimeoutMinutes, jobTimeoutMinutes) - } - // Go's timeout applies per package test binary, so this is a - // maintenance tripwire for the declared sequential tier budgets, - // not a mathematical upper bound for the multi-package first step. - if job.TimeoutMinutes <= fingerprintTimeoutMinutes+storageTimeoutMinutes+doctorTimeoutMinutes { - t.Errorf( - "test-domain-uow timeout = %d minutes, want more than %d minutes of declared tier budgets", - job.TimeoutMinutes, - fingerprintTimeoutMinutes+storageTimeoutMinutes+doctorTimeoutMinutes) - } - assertStepRunsExactly(t, job, "Test domain + uow + tracker", storageCommand) - assertStepRunsExactly(t, job, "Test doctor/fix (Dolt-backed, hard-require container)", doctorCommand) - }) - } - - // The container this job uses is compared with the checked-in - // fingerprint in its first test step - // (TestDoltServerFingerprintRunsWhereEachBackendRuns pins where). - job := readCIWorkflow(t, "pr.yml").job(t, prFingerprintJob) - assertStepRunsExactly(t, job, prFingerprintStep, - fmt.Sprintf("go test -tags gms_pure_go -count=1 -timeout %dm -v -run '^TestDoltServerFingerprint$' ./internal/testutil/", fingerprintTimeoutMinutes)) - assertStepEnvValue(t, job, prFingerprintStep, "BEADS_TEST_REQUIRE_DOLT_CONTAINER", "1") - - gate := readCIWorkflow(t, "pr.yml").job(t, "ci-gate") - gateEnv := gate.step(t, "Evaluate CI gate").Env - if !contains(gate.Needs, "test-domain-uow") { - t.Errorf("ci-gate needs test-domain-uow: %v", gate.Needs) - } - if got, want := gateEnv["TEST_DOMAIN_UOW"], "${{ needs.test-domain-uow.result }}"; got != want { - t.Errorf("ci-gate TEST_DOMAIN_UOW = %q, want %q", got, want) - } - if !contains(strings.Fields(gateEnv["CI_GATE_REQUIRED"]), "TEST_DOMAIN_UOW") { - t.Errorf("ci-gate CI_GATE_REQUIRED does not include TEST_DOMAIN_UOW: %q", gateEnv["CI_GATE_REQUIRED"]) - } -} - func TestMacOSTestJobsReuseWorkspaceBDBinary(t *testing.T) { const ( workspaceBDBinary = "${{ github.workspace }}/bd" @@ -1099,63 +1043,6 @@ func TestMacOSTestJobsReuseWorkspaceBDBinary(t *testing.T) { } } -// TestDoltTestcontainerStepsDisableRyuk pins TESTCONTAINERS_RYUK_DISABLED on -// the steps enumerated in the table below — the two Dolt-backed steps of -// pr.yml's test-domain-uow job. It is an allow-list of -// literal (workflow, job, step) triples, so it catches an un-pinning -// regression on those steps only; it does not detect the class, and a -// newly added container-starting step passes it unpinned. -// -// Why the pin: testcontainers-go shares one Ryuk reaper per host; when a step -// runs several container-starting packages as concurrent test binaries (plain -// "go test" parallelizes across packages), they race to attach to that shared -// reaper, and a failed handshake from one process reaps a sibling's live -// container mid-suite (be-2on). A GitHub Actions runner is destroyed after the -// job, so the reaper buys nothing there and only costs this race. -// -// The scope is the job, not a per-step predicate: "Test domain + uow + -// tracker" runs three container-starting package trees in one invocation and -// is the step the race is concrete on, while "Test doctor/fix" runs the single -// ./cmd/bd/doctor/fix/ package and is pinned for consistency inside the same -// job rather than because it has an in-step sibling. -// -// Left unpinned, deliberately. A step can only start a Dolt container if its -// job pre-caches the image via scripts/ci/pull-dolt-image.sh: checkDolt in -// internal/testutil gates on `docker image inspect` and never auto-pulls. The -// other jobs that do pull it are pr.yml/contract-corpus, -// pr-risk.yml/test-proxied-cmd, -// pr-risk.yml/test-server-storage and -full, and -// bazel.yml's --config=docker lane. They are out of scope for this change, not -// immune: no reap has been attributed to them, and the docker lane would -// additionally need --test_env=TESTCONTAINERS_RYUK_DISABLED=true because bazel -// does not forward ambient environment into tests. Extending the pin — and -// teaching this guard to scan for the class, the way assertGoCacheWriter below -// walks every job and step — is follow-up work on be-2on. -// -// Steps that run under BEADS_TEST_SKIP=dolt (pr-core.sh's hermetic wrapper, -// nightly.yml's full-test) never start a container at all -// and are correctly excluded: internal/testutil's readiness check treats -// BEADS_TEST_SKIP=dolt as an explicit opt-out before it ever reaches Docker. -func TestDoltTestcontainerStepsDisableRyuk(t *testing.T) { - type doltContainerStep struct { - workflow string - job string - step string - } - - steps := []doltContainerStep{ - {"pr.yml", "test-domain-uow", "Test domain + uow + tracker"}, - {"pr.yml", "test-domain-uow", "Test doctor/fix (Dolt-backed, hard-require container)"}, - } - - for _, tc := range steps { - t.Run(tc.workflow+"/"+tc.job+"/"+tc.step, func(t *testing.T) { - job := readCIWorkflow(t, tc.workflow).job(t, tc.job) - assertStepEnvValue(t, job, tc.step, "TESTCONTAINERS_RYUK_DISABLED", "true") - }) - } -} - // TestNightlyFullTestRunsEmbeddedDoltBatchApplySuite pins the nightly // full-test job's embedded-Dolt step: it must set BEADS_TEST_EMBEDDED_DOLT=1 // (the gate skipUnlessEmbeddedDolt checks) and run exactly @@ -3689,8 +3576,6 @@ func TestBazelLaneIsGatedAlongsideLegacy(t *testing.T) { "BUILD_ARTIFACTS": "build-artifacts", "PR_CORE_WRAPPER": "pr-core-wrapper", "CHECK_CMD_BD_PUREGEO_TESTS": "check-cmd-bd-puregeo-tests", - "TEST_DOMAIN_UOW": "test-domain-uow", - "CONTRACT_CORPUS": "contract-corpus", } { if !contains(required, id) || !contains(gate.Needs, job) { t.Errorf("pr.yml ci-gate no longer requires legacy %s (%s)", job, id) @@ -4469,27 +4354,30 @@ func TestBazelWorkflowPublishesBuildArtifacts(t *testing.T) { } } -// bazel-doltserver replaces pr.yml's container-backed jobs: --config=doltserver -// (hermetic dolt sql-servers, remote-executable) by default, and a dolt-server -// target in every package those jobs run. --config=docker stays reachable as -// the A/B control (dispatch dolt-lane=docker), with the jobs' image pull. +// bazel-doltserver is the only run of what pr.yml's container-backed jobs +// ("Test (storage domain + uow)", "Contract corpus") ran: --config=doltserver +// (hermetic dolt sql-servers, remote-executable), with a dolt-server target +// in every package those jobs ran. Nothing runs those suites against +// testcontainers any more: no docker lane, no requires-docker target, no +// image pull in bazel.yml, and neither job in pr.yml. func TestBazelDoltJobMirrorsContainerJobs(t *testing.T) { pr := readCIWorkflow(t, "pr.yml") - job := readCIWorkflow(t, bazelWorkflowName).job(t, bazelDoltJobName) - pull := job.step(t, "Pull Dolt sql-server image") for _, name := range []string{"test-domain-uow", "contract-corpus"} { - if want := pr.job(t, name).step(t, "Pull Dolt sql-server image").Run; pull.Run != want { - t.Errorf("%s pulls the dolt image differently from %s (%q)", bazelDoltJobName, name, want) + if _, ok := pr.Jobs[name]; ok { + t.Errorf("pr.yml has job %s again; //...:*_dolt_test on the dolt-server lane runs its tests", name) } } - if pull.If != "${{ env.BAZEL_DOLT_LANE == 'docker' }}" { - t.Errorf("%s pulls the dolt image with if %q; only the docker lane needs it", bazelDoltJobName, pull.If) + job := readCIWorkflow(t, bazelWorkflowName).job(t, bazelDoltJobName) + for _, st := range job.Steps { + if strings.Contains(st.Run, "pull-dolt-image") || strings.Contains(st.Run, "docker") { + t.Errorf("%s step %q uses docker; the dolt-server lane needs none", bazelDoltJobName, st.Name) + } } - if got := job.Env["BAZEL_DOLT_LANE"]; got != "${{ inputs.dolt-lane || 'doltserver' }}" { - t.Errorf("%s BAZEL_DOLT_LANE = %q, want the doltserver lane unless dispatched otherwise", bazelDoltJobName, got) + if _, ok := job.Env["BAZEL_DOLT_LANE"]; ok { + t.Errorf("%s still selects its lane from BAZEL_DOLT_LANE; it runs --config=doltserver only", bazelDoltJobName) } test := job.step(t, "bazel test //... --config=doltserver") - if !strings.Contains(test.Run, `bazel test //... "--config=$BAZEL_DOLT_LANE"`) || !strings.Contains(test.Run, "set -o pipefail") { + if !strings.Contains(test.Run, "bazel test //... --config=doltserver ") || !strings.Contains(test.Run, "set -o pipefail") { t.Errorf("dolt lane step does not run the lane over //...:\n%s", test.Run) } if strings.Contains(test.Run, "--config=remote-exec") { @@ -4498,37 +4386,36 @@ func TestBazelDoltJobMirrorsContainerJobs(t *testing.T) { assertTestStepKeepsExitStatus(t, test) rc := readPolicyFile(t, bazelPolicyRoot(t), ".bazelrc") - for _, want := range []string{"test:doltserver --test_tag_filters=dolt-server", "test:docker --test_tag_filters=requires-docker"} { - if !strings.Contains(rc, want+"\n") { - t.Errorf(".bazelrc lacks %q", want) - } + if !strings.Contains(rc, "test:doltserver --test_tag_filters=dolt-server\n") { + t.Errorf(".bazelrc lacks %q", "test:doltserver --test_tag_filters=dolt-server") + } + if regexp.MustCompile(`(?m)^(build|test):docker\b`).MatchString(rc) { + t.Error(".bazelrc defines a docker config again; the dolt-server lane is hermetic") } - // The packages those jobs run (test-domain-uow: domain/..., uow, - // tracker/... and doctor/fix; contract-corpus: protocol) each need a + // The packages those jobs ran (test-domain-uow: domain/..., uow, + // tracker/... and doctor/fix, and the server fingerprint, whose local + // half testutil's target runs; contract-corpus: protocol) each need a // dolt-server target. Every such target, checked on its own, picks the // local backend and fails closed, so a broken backend fails rather than // skipping into a cached pass; the ones whose TestMain owns a server also // set the package's own REQUIRE switch. root := sourceRepoRoot(t) - for pkg, docker := range map[string]bool{ - "internal/storage/domain": false, - "internal/storage/domain/db": true, - "internal/storage/domain/fs": false, - "internal/storage/domain/git": false, - "internal/storage/uow": true, - "internal/tracker": true, - "internal/tracker/conformance": false, - "cmd/bd/doctor/fix": true, - "cmd/bd/protocol": true, + for _, pkg := range []string{ + "internal/storage/domain", + "internal/storage/domain/db", + "internal/storage/domain/fs", + "internal/storage/domain/git", + "internal/storage/uow", + "internal/testutil", + "internal/tracker", + "internal/tracker/conformance", + "cmd/bd/doctor/fix", + "cmd/bd/protocol", } { - build := readPolicyFile(t, root, pkg+"/BUILD.bazel") - for _, err := range checkDoltServerRules(pkg, build) { + for _, err := range checkDoltServerRules(pkg, readPolicyFile(t, root, pkg+"/BUILD.bazel")) { t.Error(err) } - if docker && !strings.Contains(build, `"requires-docker"`) { - t.Errorf("%s/BUILD.bazel has no requires-docker variant for the docker A/B lane", pkg) - } } } @@ -4617,15 +4504,14 @@ func checkDoltServerRules(pkg, build string) []error { } // A dolt-server rule is checked on its own: another target in the same file -// (the docker variant) carrying the env must not cover for it. +// (here an untagged variant) carrying the env must not cover for it. func TestCheckDoltServerRulesPerTarget(t *testing.T) { const docker = `sh_test( - name = "uow_docker_test", + name = "uow_container_test", env = { "BEADS_TEST_DOLT_SERVER": "container", "BEADS_TEST_REQUIRE_DOLT_CONTAINER": "1", }, - tags = ["requires-docker", "no-remote-exec"], ) ` good := `load("@rules_shell//shell:sh_test.bzl", "sh_test") @@ -5158,11 +5044,10 @@ func TestBazelEmbeddedJobMirrorsEmbeddedTier(t *testing.T) { t.Errorf("setup-bazel's generated rc selects or narrows tests; it may only configure remote execution") } for line := range rc { - // Result caching: only the docker lane and nightly's fresh config - // turn it off (ci_merge_queue_test.go). - if !strings.HasPrefix(line, "#") && strings.Contains(line, "cache_test_results") && - line != "test:docker --nocache_test_results" && line != bazelFreshRCLine { - t.Errorf(".bazelrc %q: only test:docker and test:fresh set test result caching", line) + // Result caching: only nightly's fresh config turns it off + // (ci_merge_queue_test.go). + if !strings.HasPrefix(line, "#") && strings.Contains(line, "cache_test_results") && line != bazelFreshRCLine { + t.Errorf(".bazelrc %q: only test:fresh sets test result caching", line) } if strings.HasPrefix(line, "test:embedded ") && (strings.Contains(line, "-test.short") || strings.Contains(line, "BEADS_TEST_SKIP")) { t.Errorf(".bazelrc %q: the embedded jobs run without -short and BEADS_TEST_SKIP", line) diff --git a/scripts/pr_lanes_bazel_coverage_test.go b/scripts/pr_lanes_bazel_coverage_test.go index e280fb1fc..dc6148611 100644 --- a/scripts/pr_lanes_bazel_coverage_test.go +++ b/scripts/pr_lanes_bazel_coverage_test.go @@ -14,21 +14,19 @@ import ( // D2 step 3: pr.yml's own legacy jobs whose Bazel lanes run in the same // pr.yml run stand down on the PRs bazel-coverage covers (pr_lanes): -// build-artifacts, PR Core, the pure-Go/js-wasm check, domain+uow and -// contract corpus, for Bazel / test, pure-Go and js/wasm and dolt-server -// lane. ci-gate then requires those lanes to have run remotely and passed +// build-artifacts, PR Core and the pure-Go/js-wasm check, for Bazel / test +// and pure-Go and js/wasm. ci-gate then requires those lanes, and the +// dolt-server lane (the only run of the Dolt-backed domain, uow, tracker, +// doctor/fix and protocol suites), to have run remotely and passed // (BAZEL_PR_LANES_RETIRED, simulated with the other tiers in // TestPRRiskDecisionMatchesBazelMode). Everything the retired jobs did // besides those tests keeps running on every PR: the package gates take the -// Bazel-built bd, the Dolt server fingerprint runs on the dolt-server lane -// (its local half) and in test-domain-uow (its container half, where -// containers are used), and scripts-go-checks runs go test's vet checks. +// Bazel-built bd, the Dolt server fingerprint runs on the dolt-server lane, +// and scripts-go-checks runs go test's vet checks. const ( // The legacy jobs' if: not covered. prLaneLegacyIf = "needs." + prRiskCoverageJobName + ".outputs.pr_lanes != 'true'" - prFingerprintJob = "test-domain-uow" - prFingerprintStep = "Test Dolt server fingerprint (container + local)" prScriptsChecksJob = "scripts-go-checks" prScriptsChecksID = "SCRIPTS_GO_CHECKS" // bazel.yml's lanes for the step add --config=sole-run whenever they @@ -51,9 +49,7 @@ var prPackageGateIDs = map[string]string{"package-mcp": "PACKAGE_MCP", "package- var prLaneLegacyNeeds = map[string][]string{ "build-artifacts": {prRiskCoverageJobName}, "check-cmd-bd-puregeo-tests": {prRiskCoverageJobName}, - "contract-corpus": {prRiskCoverageJobName}, "pr-core-wrapper": {"build-artifacts", prRiskCoverageJobName}, - "test-domain-uow": {"build-artifacts", prRiskCoverageJobName}, } // .bazelrc's lines for the configs step 3's lanes run, exactly: the @@ -67,7 +63,7 @@ var bazelPRLaneRCLines = map[string][]string{ "test:prcore --test_arg=-test.skip=^TestEmbedded", "test:prcore --test_env=BEADS_TEST_SKIP=dolt", "test:prcore --test_env=BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION=1", - "test:prcore --test_tag_filters=-requires-docker,-dolt-server,-dolt-server-proxied,-dolt-server-integration,-dolt-server-cmd,-embedded,-manual,-integration-only", + "test:prcore --test_tag_filters=-dolt-server,-dolt-server-proxied,-dolt-server-integration,-dolt-server-cmd,-embedded,-manual,-integration-only", }, "ci": { "test:ci --config=prcore", @@ -138,8 +134,8 @@ echo "pure cmd/bd subset: $n test cases" "bazel test //... --config=doltserver": `set -o pipefail start=$(date +%s) rc=0 -bazel test //... "--config=$BAZEL_DOLT_LANE" ${BAZEL_SOLE_RUN:+"$BAZEL_SOLE_RUN"} ${BAZEL_FRESH:+"$BAZEL_FRESH"} 2>&1 | tee "$RUNNER_TEMP/bazel-test.log" || rc=$? -echo "bazel test --config=$BAZEL_DOLT_LANE: exit $rc, $(( $(date +%s) - start ))s wall" | tee -a "$GITHUB_STEP_SUMMARY" +bazel test //... --config=doltserver ${BAZEL_SOLE_RUN:+"$BAZEL_SOLE_RUN"} ${BAZEL_FRESH:+"$BAZEL_FRESH"} 2>&1 | tee "$RUNNER_TEMP/bazel-test.log" || rc=$? +echo "bazel test --config=doltserver: exit $rc, $(( $(date +%s) - start ))s wall" | tee -a "$GITHUB_STEP_SUMMARY" exit "$rc"`, }, } @@ -546,30 +542,19 @@ func testPackageGateJobs(t *testing.T, prGateRequired []string) { } } -// The Dolt server fingerprint is checked once per backend, where that backend -// runs: the local server (the pinned dolt CLI every Bazel dolt-server lane -// starts) by //internal/testutil:testutil_dolt_test on the dolt-server lane, -// whatever the mode (the retired every-PR job, "Test (Dolt server -// fingerprint)", pulled a docker image the workers do not have); the -// container by test-domain-uow, the container-backed job that runs only -// where bazel-coverage does not cover pr_lanes, as its first test step. No -// other pr.yml job runs it, and ci-gate has no separate fingerprint result. -func TestDoltServerFingerprintRunsWhereEachBackendRuns(t *testing.T) { +// The Dolt server fingerprint runs in CI on the local backend only: the +// pinned dolt CLI every Bazel dolt-server lane starts, checked by +// //internal/testutil:testutil_dolt_test on the dolt-server lane whatever the +// mode. No CI job runs the Dolt-backed suites against the container backend +// any more, so none runs its container half (plain `go test` does, wherever +// docker and the image are present), and no pr.yml job runs the fingerprint +// or reports a separate fingerprint result. +func TestDoltServerFingerprintRunsOnTheDoltServerLane(t *testing.T) { pr := readCIWorkflow(t, "pr.yml") - job := pr.job(t, prFingerprintJob) - if job.If != prLaneLegacyIf { - t.Errorf("%s if %q, want %q (the container-backed tests run only there)", prFingerprintJob, job.If, prLaneLegacyIf) - } - step := job.step(t, prFingerprintStep) - if step.If != "" || step.ContinueOnError != nil { - t.Errorf("%s step %q: if %q, continue-on-error %v", prFingerprintJob, prFingerprintStep, step.If, step.ContinueOnError) - } - assertStepsBefore(t, job, []string{"Install Dolt CLI", "Pull Dolt sql-server image"}, []string{prFingerprintStep}) - assertStepsBefore(t, job, []string{prFingerprintStep}, []string{"Test domain + uow + tracker"}) for name, j := range pr.Jobs { for _, s := range j.Steps { - if strings.Contains(s.Run, "TestDoltServerFingerprint") && (name != prFingerprintJob || s.Name != prFingerprintStep) { - t.Errorf("%s step %q runs the fingerprint; only %s's %q does", name, s.Name, prFingerprintJob, prFingerprintStep) + if strings.Contains(s.Run, "TestDoltServerFingerprint") { + t.Errorf("%s step %q runs the fingerprint; //internal/testutil:testutil_dolt_test does", name, s.Name) } } } diff --git a/scripts/pr_risk_bazel_coverage_test.go b/scripts/pr_risk_bazel_coverage_test.go index 200dfc7d8..0157ad143 100644 --- a/scripts/pr_risk_bazel_coverage_test.go +++ b/scripts/pr_risk_bazel_coverage_test.go @@ -88,8 +88,6 @@ var retiredTiers = []retiredTier{ "build-artifacts": "BUILD_ARTIFACTS", "pr-core-wrapper": "PR_CORE_WRAPPER", "check-cmd-bd-puregeo-tests": "CHECK_CMD_BD_PUREGEO_TESTS", - "test-domain-uow": "TEST_DOMAIN_UOW", - "contract-corpus": "CONTRACT_CORPUS", }, bazelLanes: []string{bazelJobName, bazelPureJobName, bazelDoltJobName}, }, @@ -1962,7 +1960,7 @@ var bazelDoltServerRCLines = map[string][]string{ // D2 step 2, as review F2/F4 for embedded: the proxied and server lanes run // exactly `bazel test //... --config=` (plus nightly's BAZEL_FRESH) // with a BEP and nothing else, their configs are exactly the pinned lines, -// and only test:docker and test:fresh set result caching. +// and only test:fresh sets result caching. func TestBazelRetiredLanesArePinned(t *testing.T) { workflow := readCIWorkflow(t, bazelWorkflowName) for lane, config := range bazelRetiredLaneConfigs { @@ -2010,13 +2008,13 @@ func TestBazelRetiredLanesArePinned(t *testing.T) { } } // A later --cache_test_results (any config the lanes use) would win. - // Only the docker lane and nightly's --config=fresh (appended only when - // the caller asks, ci_merge_queue_test.go) turn result caching off. - allowed := map[string]bool{"test:docker --nocache_test_results": true, bazelFreshRCLine: true} + // Only nightly's --config=fresh (appended only when the caller asks, + // ci_merge_queue_test.go) turns result caching off. + allowed := map[string]bool{bazelFreshRCLine: true} for _, line := range strings.Split(rc, "\n") { line = strings.TrimSpace(line) if !strings.HasPrefix(line, "#") && strings.Contains(line, "cache_test_results") && !allowed[line] { - t.Errorf(".bazelrc %q: only test:docker and test:fresh set test result caching", line) + t.Errorf(".bazelrc %q: only test:fresh sets test result caching", line) } } } diff --git a/scripts/pull_dolt_image_test.go b/scripts/pull_dolt_image_test.go index 477d68f44..b4d1f1a92 100644 --- a/scripts/pull_dolt_image_test.go +++ b/scripts/pull_dolt_image_test.go @@ -53,23 +53,14 @@ func TestPullDoltImageRetriesTransientFailures(t *testing.T) { } func TestDoltImagePullWorkflowsUseRetryHelper(t *testing.T) { + // Only pr-risk.yml's legacy container-backed tiers pull the image; every + // pr.yml and bazel.yml Dolt suite runs on hermetic dolt sql-servers + // (the dolt-server lanes) and needs no docker. wantCalls := map[string]int{ - "pr.yml": 2, // test-domain-uow, contract-corpus "pr-risk.yml": 3, } workflowsDir := filepath.Join(sourceRepoRoot(t), ".github", "workflows") - for name, want := range wantCalls { - data, err := os.ReadFile(filepath.Join(workflowsDir, name)) - if err != nil { - t.Fatal(err) - } - text := string(data) - if got := strings.Count(text, "run: ./scripts/ci/pull-dolt-image.sh"); got != want { - t.Errorf("%s retry-helper calls = %d, want %d", name, got, want) - } - } - workflowPaths, err := filepath.Glob(filepath.Join(workflowsDir, "*.y*ml")) if err != nil { t.Fatal(err) @@ -79,8 +70,13 @@ func TestDoltImagePullWorkflowsUseRetryHelper(t *testing.T) { if err != nil { t.Fatal(err) } - if strings.Contains(string(data), "docker pull "+doltSQLServerImage) { - t.Errorf("%s still pulls the Dolt image without retries", filepath.Base(path)) + text := string(data) + name := filepath.Base(path) + if got, want := strings.Count(text, "run: ./scripts/ci/pull-dolt-image.sh"), wantCalls[name]; got != want { + t.Errorf("%s retry-helper calls = %d, want %d", name, got, want) + } + if strings.Contains(text, "docker pull "+doltSQLServerImage) { + t.Errorf("%s still pulls the Dolt image without retries", name) } } } diff --git a/tools/bazel/BUILD.bazel b/tools/bazel/BUILD.bazel index 79fdab72a..2c8fa7459 100644 --- a/tools/bazel/BUILD.bazel +++ b/tools/bazel/BUILD.bazel @@ -14,7 +14,7 @@ _DOLT_PLATFORMS_ONLY = select({ }) # sh_test src for a second test target over an existing go_test binary (see -# the script header), e.g. //cmd/bd/doctor/fix:fix_docker_test. +# the script header), e.g. //cmd/bd/doctor/fix:fix_dolt_test. exports_files( ["go_test_variant.sh"], visibility = ["//visibility:public"], diff --git a/tools/bazel/equivalence.py b/tools/bazel/equivalence.py index 256c7c248..f45998fde 100644 --- a/tools/bazel/equivalence.py +++ b/tools/bazel/equivalence.py @@ -32,7 +32,7 @@ Two checks always run, a third when `go test -json` output is supplied: Job mode (--job, with --go-test-json): the go test JSON is the whole expected set instead of `go list ./...`. Use it to prove that a Bazel selection (one or -more --bep runs, e.g. --config=ci plus --config=docker) replaces one specific +more --bep runs, e.g. --config=ci plus --config=doltserver) replaces one specific CI job: every top-level test the job's command ran must have run under Bazel, Bazel must run no other test in those packages (TestEmbedded* included: job mode has no implicit ^TestEmbedded skip, so it can check the embedded tier), and no test the job passed may diff --git a/tools/bazel/race.bzl b/tools/bazel/race.bzl index 570efcb3d..27296f6ee 100644 --- a/tools/bazel/race.bzl +++ b/tools/bazel/race.bzl @@ -1,11 +1,11 @@ """go_test_race_off: an existing go_test built without the race detector. -The docker lane (--config=docker) sets --@rules_go//go/config:race for every -target, because pr.yml's container jobs run `go test -race`, except the -Contract corpus job, which does not. A go_test_variant.sh sh_test over this -rule's output runs such a package the way that job does, without a second -go_test rule (whose srcs gazelle would not maintain). The go_test keeps its own -`race = "auto"` and so follows the setting this transition gives it. +The dolt-server lane (--config=doltserver) sets --@rules_go//go/config:race +for every target, because the container jobs it replaced ran `go test -race`, +except the Contract corpus job, which did not. A go_test_variant.sh sh_test +over this rule's output runs such a package the way that job did, without a +second go_test rule (whose srcs gazelle would not maintain). The go_test keeps +its own `race = "auto"` and so follows the setting this transition gives it. """ _RACE = "@rules_go//go/config:race"