Files
Brad Fitzpatrick 60009b5ddc tstest/integration: reuse built binaries across test processes on build VMs
GetBinaries builds cmd/tailscale and cmd/tailscaled once per process,
into the first test's temp dir. The go command caches compiled
packages but not linked binaries, so that build costs a few seconds
(2.8s on an idle 14-CPU VM, much more under load) even when every
package is in the build cache. Test runners that run each test in its
own process, such as gotst, pay it for every integration test.

On ephemeral build VMs, which have ~/.is-ephemeral-build-vm, now
install the binaries into a directory under the user cache directory
that later test processes reuse, so that "go install" skips relinking
binaries that are already up to date. Each GOOS, GOARCH, race mode, and
checkout gets its own subdirectory, so they don't keep replacing each
other's binaries. A file lock serializes the build and the opening of
the binaries across processes, so concurrent test processes build once
and each opens complete binaries. Tests still get their own copies in
their temp dirs, as before. $TS_INTEGRATION_BIN_CACHE names a
directory to use anywhere, as for local use; otherwise, as when
employees run go test on their own machines, nothing changes and
nothing is left behind. Windows keeps building into the temp dir for
now, lacking a file lock here.

With the cache, TestOneNodeUpNoAuth in its own process went from 2.0s
to 0.6s.

Updates tailscale/corp#28679
Updates tailscale/corp#46045

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Change-Id: I01dec43ae80dafac2a05561999d6090f2139fcfd
2026-12-05 14:28:32 +00:00
..