From 416b6e4048c4b78c05cba8775907b1a4615b31c5 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Sat, 28 Nov 2026 19:56:04 -0600 Subject: [PATCH 1/2] test(site): Wait for the burn-in sighting The Redfish lab moved its clock past the burn-in, then slept 50ms and assumed the worker polled the console in that gap. On a loaded CI runner the poll can miss it, so the last stored sighting predates the move, the measured burn-in is near zero, and a passing commissioning fails as too short. Tests that ran a full burn-in flaked this way. The lab now waits until the worker stores a sighting on the moved clock. A move shorter than the persist interval stores nothing new, so it keeps the short pause. With the worker's poll slowed to 100ms the old lab fails the burn-in tests and this one passes. Co-Authored-By: Claude Opus 5.5 --- internal/site/redfishwork/kinds_test.go | 34 ++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/internal/site/redfishwork/kinds_test.go b/internal/site/redfishwork/kinds_test.go index bc51f28a..d4c1fb54 100644 --- a/internal/site/redfishwork/kinds_test.go +++ b/internal/site/redfishwork/kinds_test.go @@ -27,6 +27,7 @@ import ( "go.datum.net/fleet/internal/bmcdiscovery" "go.datum.net/fleet/internal/redfish" "go.datum.net/fleet/internal/site" + "go.datum.net/fleet/internal/site/burnin" ) const ( @@ -178,6 +179,31 @@ func (l *lab) ServeHTTP(w http.ResponseWriter, r *http.Request) { json.NewEncoder(w).Encode(doc) } +// awaitSighting waits until the worker has stored a sighting of the console +// without the receipt at or after moved. A worker stores a sighting at least +// every burnin.PersistEvery of store time, so a shorter move has nothing new +// to wait for and gets a short pause instead. +func (l *lab) awaitSighting(moved time.Time) { + if l.burnTime < burnin.PersistEvery { + time.Sleep(50 * time.Millisecond) + return + } + for deadline := time.Now().Add(10 * time.Second); ; time.Sleep(5 * time.Millisecond) { + var record burnin.Record + if _, err := l.store.GetRecord(device, burnin.Records, l.operation, &record); err != nil { + l.t.Error(err) + return + } + if !record.AbsentAt.Before(moved) { + return + } + if time.Now().After(deadline) { + l.t.Error("the worker never polled the console on the moved clock") + return + } + } +} + // boot runs the armed boot, as the server and the boot server would. func (l *lab) boot(target string) { time.Sleep(30 * time.Millisecond) @@ -199,10 +225,12 @@ func (l *lab) boot(target string) { l.mu.Lock() result := l.burnIn l.skew += l.burnTime + moved := time.Now().Add(l.skew) l.mu.Unlock() - // Let the worker poll the console once more on the moved clock - // before the receipt appears, as it would while a real burn-in ran. - time.Sleep(50 * time.Millisecond) + // Let the worker see the console without the receipt on the moved + // clock before the receipt appears, as it would while a real burn-in + // ran. A sleep alone races the worker's poll on a loaded machine. + l.awaitSighting(moved) line = fmt.Sprintf("FLEET-BURNIN:%s:%s", boot.Receipt, result) for range l.receipts - 1 { line += fmt.Sprintf("\nFLEET-BURNIN:%s:%s", boot.Receipt, result) From 4c0aa617a6e3db06960283f9485061535d8d080c Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Sat, 28 Nov 2026 19:58:33 -0600 Subject: [PATCH 2/2] test(site): Wait for the first burn-in sighting A burn-in shorter than the persist interval kept the 50ms pause, so the too-short and restart tests still relied on the worker polling before the receipt. The lab now waits for the worker's first stored sighting there. That gap has not been seen to fail, even with the poll slowed to 100ms, because the first sighting lands well before the receipt. Co-Authored-By: Claude Opus 5.5 --- internal/site/redfishwork/kinds_test.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/site/redfishwork/kinds_test.go b/internal/site/redfishwork/kinds_test.go index d4c1fb54..7070dbad 100644 --- a/internal/site/redfishwork/kinds_test.go +++ b/internal/site/redfishwork/kinds_test.go @@ -180,21 +180,19 @@ func (l *lab) ServeHTTP(w http.ResponseWriter, r *http.Request) { } // awaitSighting waits until the worker has stored a sighting of the console -// without the receipt at or after moved. A worker stores a sighting at least -// every burnin.PersistEvery of store time, so a shorter move has nothing new -// to wait for and gets a short pause instead. +// without the receipt at or after moved. A worker stores its first sighting +// at once and then at least every burnin.PersistEvery of store time, so a +// shorter move waits only for the first one. A move of exactly PersistEvery +// is stored because real time also passes between the polls. func (l *lab) awaitSighting(moved time.Time) { - if l.burnTime < burnin.PersistEvery { - time.Sleep(50 * time.Millisecond) - return - } + short := l.burnTime < burnin.PersistEvery for deadline := time.Now().Add(10 * time.Second); ; time.Sleep(5 * time.Millisecond) { var record burnin.Record if _, err := l.store.GetRecord(device, burnin.Records, l.operation, &record); err != nil { l.t.Error(err) return } - if !record.AbsentAt.Before(moved) { + if short && !record.AbsentAt.IsZero() || !record.AbsentAt.Before(moved) { return } if time.Now().After(deadline) {