TestHandleUpdate_ImageCleanupFailureKeepsUpdateDone reads the replaced string after waiting for update state done. The update goroutine writes that string in selfReplace, which runs after done is published. There is no synchronization between those accesses.
Observed during local make verify: updater self-replace target = "". Confirmed with:
cd go
go test -race -tags=netgo,osusergo ./cmd/ftw-updater -run '^TestHandleUpdate_ImageCleanupFailureKeepsUpdateDone$' -count=10
The race detector reports the read at image_prune_test.go:103 and write at image_prune_test.go:94. This is a race in the test callback and assertion; this evidence does not establish a failed real updater replacement.
Replace the shared string with a buffered channel and wait with a bounded timeout for the replacement callback before asserting its target. Keep the test that cleanup failure leaves the update done.
TestHandleUpdate_ImageCleanupFailureKeepsUpdateDonereads thereplacedstring after waiting for update statedone. The update goroutine writes that string inselfReplace, which runs afterdoneis published. There is no synchronization between those accesses.Observed during local
make verify:updater self-replace target = "". Confirmed with:The race detector reports the read at image_prune_test.go:103 and write at image_prune_test.go:94. This is a race in the test callback and assertion; this evidence does not establish a failed real updater replacement.
Replace the shared string with a buffered channel and wait with a bounded timeout for the replacement callback before asserting its target. Keep the test that cleanup failure leaves the update done.