#!/bin/sh # mesh-check-toolchain: go # # The Go part of the SDK's own check (novox/hq ADR 0237 as amended, ADR 0272): the Go binding, run by the build # seat in the mesh's Go toolchain, its own container, because the SDK's merge-check.sh declares it # (`# mesh-check-also: go go/merge-check.sh`) — and by hand, from anywhere: `sh go/merge-check.sh`. # # Formatted, vetted (with and without the build tag `integration`), and run at two levels (novox/hq ADR 0391): # # 1. the unit level: `go test ./...` untagged, no bus or other process, timed and held to a bound # (unit_bound below); over it the check fails and names the slowest tests (issue 895); # 2. the integration level: the whole suite with `-tags integration`, each test against a bus of its # own (internal/testbus, which issue 1171 brings with the first test that needs a bus) so nothing is # serialised. With no tagged test yet, the level runs the unit tests again and says their count. # # **A test that starts a bus or another process carries `//go:build integration`** as the first line of # its file; a file that held both kinds is two files (`_integration_test.go` beside `_test.go`). # Each level says its test count and its time. # # Every dependency this binding takes (none yet; nats.go and an embedded nats-server with issue 1171) is # vendored into go/vendor, so a run with the network off fetches nothing; `go mod vendor` after a `go.mod` or # `go.sum` change keeps it so. gofmt reads only the binding's own files, never go/vendor. # # Exit 0 is a pass; anything else fails `mesh/repo-check` with the last line printed. set -eu cd "$(dirname "$0")" export GOFLAGS=-mod=vendor GOPROXY=off # **The unit level's bound, in seconds** (issue 895): the slowest package's own test time of the untagged run, # the compile not counted. A run over it fails the check and names the slowest tests. The SDK's unit suite is # small (its slowest package measured well under a second on a quiet machine), so 2 s leaves room for a busier # build node without hiding a test that should carry `integration` instead. unit_bound=2 # judge_unit_run says the unit level as `go test -v` reported it and fails when it was over the bound: $1 the # file holding the output of the untagged `go test -v` of every package (packages one after another, each # ending in its `ok