diff --git a/merge-check.sh b/merge-check.sh index d3b7d97c..772823ff 100755 --- a/merge-check.sh +++ b/merge-check.sh @@ -192,6 +192,19 @@ for m in $touched; do # another process) run here and nowhere else: the unit suite stays under a second (novox/hq playbook 07). (cd "modules/$m" && CGO_ENABLED=$cgo GOPRIVATE=git.novox.be go vet -tags integration ${modfile:+"-modfile=$modfile"} ./... && CGO_ENABLED=$cgo GOPRIVATE=git.novox.be go test -tags integration ${modfile:+"-modfile=$modfile"} $race -count=1 ./...) + # The docker tests of the bus's snapshot program and entrypoint (novox/hq ADR 0480 clause 6) start throwaway nats + # containers, and the Go toolchain container holds no docker, so above they skip with a "NOT RUN" line. Where the + # build seat says docker exists (MESH_CHECK_DOCKER=1) they run here by name, and a missing docker fails the check + # (MESH_REQUIRE_DOCKER=1 makes the tests fail instead of skip). Without it the step says it did not run. + if [ "$m" = nats ]; then + if [ "${MESH_CHECK_DOCKER:-}" = 1 ]; then + (cd modules/nats && MESH_REQUIRE_DOCKER=1 CGO_ENABLED=$cgo GOPRIVATE=git.novox.be go test -tags integration ${modfile:+"-modfile=$modfile"} -count=1 \ + -run 'TestTheDeclaredDumpRunsInTheBussImage|TestTheEntrypointReloadsTheServerWithoutDroppingAConnection|TestTheStoreSurvivesTheNewDeclarationTheOldAndTheNewAgain|TestASnapshotOfALiveBusRestoresToTheSameContent|TestTheSnapshotUserCannotChangeTheBus' \ + ./cmd/mesh-nats-snapshot) || { echo "the bus's docker tests failed"; exit 1; } + else + echo "NOT RUN: the bus's five docker tests (modules/nats/cmd/mesh-nats-snapshot) skipped: this check has no docker (MESH_CHECK_DOCKER is not 1)" + fi + fi done if [ -n "$untestable" ]; then echo "the check fails: the tests of$untestable could not run (novox/hq issue 385)" diff --git a/modules/nats/cmd/mesh-nats-snapshot/live_test.go b/modules/nats/cmd/mesh-nats-snapshot/live_test.go index 95e8ea7d..3c173340 100644 --- a/modules/nats/cmd/mesh-nats-snapshot/live_test.go +++ b/modules/nats/cmd/mesh-nats-snapshot/live_test.go @@ -60,7 +60,13 @@ var snapshotGrants = struct{ publish, subscribe []string }{ func needDocker(t *testing.T) { t.Helper() if _, err := exec.LookPath("docker"); err != nil { - t.Fatalf("these tests start throwaway nats containers and need docker on the machine that runs them: %v", err) + // The Go toolchain container of the merge check holds no docker. Where docker is expected + // (MESH_REQUIRE_DOCKER=1, which merge-check.sh sets for its docker step) its absence is a failure. + if os.Getenv("MESH_REQUIRE_DOCKER") == "1" { + t.Fatalf("MESH_REQUIRE_DOCKER=1 and there is no docker here: %v", err) + } + t.Skipf("NOT RUN: this test starts a throwaway nats container and there is no docker in this toolchain (%v); "+ + "it is proof only where merge-check.sh's docker step runs it (MESH_CHECK_DOCKER=1)", err) } }