This is an automated email from the ASF dual-hosted git repository.

zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git


The following commit(s) were added to refs/heads/main by this push:
     new c1bd75d30 test(table): deflake 
TestPositionDeletePartitionedNoGoroutineLeak (#2289)
c1bd75d30 is described below

commit c1bd75d3036295e97913904e7dc76ac14a1bc3a5
Author: Matt Topol <[email protected]>
AuthorDate: Fri Oct 23 17:18:34 2026 +0100

    test(table): deflake TestPositionDeletePartitionedNoGoroutineLeak (#2289)
    
    The test compared runtime.NumGoroutine before and after 50 writes while 
running in parallel with other table tests, whose goroutines counted as leaks. 
It failed on main (runs 39276480459, 39674109108) and on unrelated PRs with 
deltas of 6. Run it serially and fail only on growth that scales with the 
iteration count; the leak it guards against adds one goroutine per iteration.
---
 table/pos_delete_partitioned_fanout_writer_test.go | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/table/pos_delete_partitioned_fanout_writer_test.go 
b/table/pos_delete_partitioned_fanout_writer_test.go
index 17229dd19..b45536c79 100644
--- a/table/pos_delete_partitioned_fanout_writer_test.go
+++ b/table/pos_delete_partitioned_fanout_writer_test.go
@@ -477,9 +477,9 @@ func 
TestPositionDeletePartitionedFanoutWriterEarlyStopCancelsRecordProduction(t
        require.Zero(t, mem.CurrentAlloc())
 }
 
+// Not parallel: runtime.NumGoroutine counts every goroutine in the test 
binary,
+// so goroutines started by concurrently running tests would count as leaks.
 func TestPositionDeletePartitionedNoGoroutineLeak(t *testing.T) {
-       t.Parallel()
-
        partitionSpec := iceberg.NewPartitionSpec(iceberg.PartitionField{
                SourceIDs: []int{2},
                Name:      "age_bucket",
@@ -541,9 +541,11 @@ func TestPositionDeletePartitionedNoGoroutineLeak(t 
*testing.T) {
        after := runtime.NumGoroutine()
 
        // Before the fix, each iteration leaked a goroutine from 
iter.Pull(args.counter)
-       // being called unconditionally but stopCount never invoked in the 
partitioned path.
-       // Allow a small margin for background runtime goroutines.
-       assert.LessOrEqual(t, after, before+5,
+       // being called unconditionally but stopCount never invoked in the 
partitioned path,
+       // so a regression grows the count by about one per iteration. 
Goroutines left by
+       // earlier tests can still start or exit in between, so only fail on 
growth that
+       // scales with the iteration count.
+       assert.Less(t, after-before, iterations/2,
                "expected no goroutine growth after %d iterations, got %d -> %d 
(delta: %d)",
                iterations, before, after, after-before)
 }

Reply via email to