tailscale/tstest
Brad Fitzpatrick 8dde9b725b tstest/natlab/vmtest: serialize ensureDebugSSHKey across parallel boots
Env.Start boots all VM nodes in parallel; each calls
createCloudInitISO -> ensureDebugSSHKey concurrently. When
/tmp/vmtest_key doesn't yet exist, the first goroutine creates it
with os.WriteFile, which opens with O_CREATE|O_TRUNC and briefly
leaves the file existing-but-empty between the open and the
subsequent write. A concurrent goroutine that hits that window
sees ReadFile succeed with zero bytes, then fails ssh.ParsePrivateKey
with "ssh: no key found", causing boot to fail with:

  boot: creating cloud-init ISO: parse /tmp/vmtest_key: ssh: no key found

Observed in CI on TestSiteToSite (3 nodes). Wrap the function in
a package-level Mutex so the first caller fully writes the key
before any other caller reads it.

Updates #20228

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Change-Id: Ie6399dcba0c397bb8041931d3de1c6063a11c568
2026-06-24 09:22:28 -07:00
..
archtest all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
chonktest all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
deptest all: use Go 1.26 things, run most gofix modernizers 2026-03-06 13:32:03 -08:00
integration tstest/integration/testcontrol: expire individual node keys 2026-06-11 19:21:09 +01:00
iosdeps wgengine/netstack, net/ping: stop using pro-bing and use our net/ping instead 2026-05-04 14:05:24 -07:00
jsdeps all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
largetailnet cmd/testwrapper, tstest: move test sharding out of test code 2026-05-27 16:53:17 -07:00
mts all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
natlab tstest/natlab/vmtest: serialize ensureDebugSSHKey across parallel boots 2026-06-24 09:22:28 -07:00
nettest go.toolchain.branch: switch to Go 1.26 2026-03-04 21:57:05 -08:00
tailmac tstest/natlab/vmtest: add macOS VM snapshot caching for fast test starts 2026-04-29 08:17:13 -07:00
tkatest all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
tlstest all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
tools all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
typewalk all: use Go 1.26 things, run most gofix modernizers 2026-03-06 13:32:03 -08:00
allocs.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
clock_test.go cmd/vet: add subtestnames analyzer; fix all existing violations 2026-04-05 15:52:51 -07:00
clock.go tstest/clock: explain what happens if you don't set a Start time 2026-04-28 00:15:46 +02:00
kernel_linux_test.go tstest: fix kernel version parsing for Debian-style version strings 2026-04-14 07:11:44 -07:00
kernel_linux.go tstest: fix kernel version parsing for Debian-style version strings 2026-04-14 07:11:44 -07:00
kernel_other.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
log_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
log.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
reflect.go types/ptr: deprecate ptr.To, use Go 1.26 new 2026-03-05 20:13:18 -08:00
resource_test.go cmd/vet: add subtestnames analyzer; fix all existing violations 2026-04-05 15:52:51 -07:00
resource.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
test-wishlist.md wf: allow limited broadcast to/from permitted interfaces when using an exit node on Windows 2026-01-23 18:30:38 -06:00
tstest_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
tstest.go cmd/testwrapper, tstest: move test sharding out of test code 2026-05-27 16:53:17 -07:00