mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
master: the line-wake test waits for the grace's rebuild (build 2) before the heartbeat
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
db7f6530a3
commit
d17696d1ea
1 file changed
+6
-4
@@ -42,12 +42,12 @@ func TestMasterRebuildsObservationOnAPublishedLine(t *testing.T) {
|
||||
// buffered and no deadline timer fires within the test (the one-hour
|
||||
// expiry timer stays armed), all read under the host's lock; it returns
|
||||
// the builds done.
|
||||
settle := func(what string) uint64 {
|
||||
settle := func(what string, atLeast uint64) uint64 {
|
||||
t.Helper()
|
||||
deadline := time.Now().Add(5 * time.Second)
|
||||
for time.Now().Before(deadline) {
|
||||
started, done, buffered, timerAt := h.obs.BuildsForTest()
|
||||
if started == done && done > 0 && !buffered && (timerAt.IsZero() || timerAt.After(time.Now().Add(time.Minute))) {
|
||||
if started == done && done >= atLeast && !buffered && (timerAt.IsZero() || timerAt.After(time.Now().Add(time.Minute))) {
|
||||
return done
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
@@ -78,8 +78,10 @@ func TestMasterRebuildsObservationOnAPublishedLine(t *testing.T) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
// The initial build and the 1 ms grace's rebuild, finished.
|
||||
n := settle("startup")
|
||||
// The initial build (#1) and the 1 ms grace's rebuild (#2, with nothing
|
||||
// ingested yet) both finished: the grace's deadline is consumed, so no
|
||||
// timer can arm after this point and see the heartbeat.
|
||||
n := settle("startup", 2)
|
||||
if err := h.obs.IngestHeartbeat(authority.HeartbeatMessage{
|
||||
ServerID: "node-a", SentAt: time.Now().UTC(), Reachable: true, Eligible: true,
|
||||
Slots: []authority.HeartbeatSlot{{VolumeID: "v1", ReplicaID: "r1", DataAddr: "127.0.0.1:9201", CtrlAddr: "127.0.0.1:9101", Reachable: true, ReadyForPrimary: true, Eligible: true}},
|
||||
|
||||
Reference in new issue
Block a user