Turned off, Keep looks at the setting at each beat, the multiples of
filememo.OthersEvery (5s) on the clock. The test counted Keep's looks
over a fixed 50ms, so a beat inside that window made a second look and
the test red, about one run in 100. That happened in the full suite on
mote at e9bde2520 ("looked at the setting 2 times in 50ms"). The test
now waits out a beat that is under a second away before it starts Keep,
as TestKeepOffSeesAWriteDuringTheLook does. Keep's code is unchanged,
as #3687 found.
Run (mote): go test -count=400 -run 'TestKeepOffWaitsForTheSetting$'
./internal/awake ok (26.7s); go test ./internal/awake ./internal/beat
ok; GOOS=linux and GOOS=windows go vet ./internal/awake ok; gofmt clean.
Broken by hand: the window put 30ms before a beat (sleep to it) without
the new wait, red 3 of 3 with the line above. With the wait, ok 3 of 3.
Not done here: #3687's comment also asks for a write-while-off check in
this test and a deferred cancel in TestKeep and TestKeepDisplay. Those
stay open on #3687.