This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
The following commit(s) were added to refs/heads/main by this push:
new e6cdef2c test(fodc): fix Capacity Size and Heap Inused Size (#910)
e6cdef2c is described below
commit e6cdef2cd8bb6a4df95c1a62a547b5cecd8d4060
Author: Fine0830 <[email protected]>
AuthorDate: Mon Dec 22 11:02:24 2025 +0800
test(fodc): fix Capacity Size and Heap Inused Size (#910)
---
fodc/internal/integration/capacity_heap_test.go | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/fodc/internal/integration/capacity_heap_test.go
b/fodc/internal/integration/capacity_heap_test.go
index 4b8bfe13..5da18d92 100644
--- a/fodc/internal/integration/capacity_heap_test.go
+++ b/fodc/internal/integration/capacity_heap_test.go
@@ -19,6 +19,7 @@ package integration_test
import (
"runtime"
+ "time"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
@@ -409,8 +410,25 @@ var _ = Describe("Test Case 4: Capacity Size and Heap
Inuse Size", func() {
Expect(initialCapacitySize).To(Equal(capacitySize), "Initial
capacity size should match configured value")
// Step 2: Measure baseline heap inuse size (before any data)
- // Force GC to reduce temporary allocation noise
- runtime.GC()
+ // Force GC multiple times and wait for heap size to stabilize
+ var prevHeapSize int64
+ Eventually(func() bool {
+ runtime.GC()
+ time.Sleep(100 * time.Millisecond)
+ currentHeapSize := fr.HeapInuseSize()
+
+ if prevHeapSize > 0 {
+ diff := currentHeapSize - prevHeapSize
+ if diff < 0 {
+ diff = -diff
+ }
+ if diff < 1024 {
+ return true
+ }
+ }
+ prevHeapSize = currentHeapSize
+ return false
+ }, 5*time.Second, 200*time.Millisecond).Should(BeTrue())
baselineHeapInuseSize := fr.HeapInuseSize()
Expect(baselineHeapInuseSize).To(BeNumerically(">", 0),
"Baseline heap inuse size should be positive")