eth: use loop+select polling to speed up test

This commit is contained in:
lightclient 2025-08-26 14:52:55 -06:00
parent 1c57917465
commit 8574028a97
No known key found for this signature in database
GPG key ID: 657913021EF45A6A

View file

@ -89,13 +89,14 @@ func testSnapSyncDisabling(t *testing.T, ethVer uint, snapVer uint) {
t.Fatal("sync failed:", err)
}
// Wait for downloader to finish processing with a timeout
for t0 := time.Now(); time.Since(t0) < 10*time.Second; time.Sleep(100 * time.Millisecond) {
if !empty.handler.snapSync.Load() {
break
}
}
if empty.handler.snapSync.Load() {
for timeout := time.After(5 * time.Second); ; {
select {
case <-timeout:
t.Fatalf("snap sync not disabled after successful synchronisation")
case <-time.After(100 * time.Millisecond):
if !empty.handler.snapSync.Load() {
return
}
}
}
}