mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-16 04:06:44 +00:00
test: wait for async write-budget release after pipeline shutdown (#10530)
Shutdown drops the sealed-chunk map references, but an in-flight uploader goroutine holds the final reference and releases its budget slot only after reacquiring chunksLock. Asserting Used()==0 immediately after Shutdown races those releases on slow runners. Poll with a bounded deadline instead.
This commit is contained in:
@@ -160,6 +160,12 @@ func TestWriteBufferCap_SharedAcrossPipelines(t *testing.T) {
|
||||
if got := observedMax.Load(); got > capBytes {
|
||||
t.Fatalf("observed Used()=%d exceeded cap=%d", got, capBytes)
|
||||
}
|
||||
// An uploader goroutine releases its budget slot only after reacquiring
|
||||
// chunksLock post-Shutdown, so the last releases may land asynchronously.
|
||||
drainDeadline := time.Now().Add(5 * time.Second)
|
||||
for acc.Used() != 0 && time.Now().Before(drainDeadline) {
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
}
|
||||
if got := acc.Used(); got != 0 {
|
||||
t.Fatalf("expected 0 used after shutdown, got %d", got)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user