Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

test: wait for async write-budget release after pipeline shutdown (#10530)

Chris Luc21d92b70a09
diff --git a/weed/mount/page_writer/write_buffer_cap_integration_test.go b/weed/mount/page_writer/write_buffer_cap_integration_test.go
index 2a44f42959..1751124819 100644
--- a/weed/mount/page_writer/write_buffer_cap_integration_test.go
+++ b/weed/mount/page_writer/write_buffer_cap_integration_test.go
@@ -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)
}