aboutsummaryrefslogtreecommitdiff
path: root/internal/bufpool/buffers_test.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-02-21 20:42:02 +0800
committerGravatar Runxi Yu2026-02-21 20:42:02 +0800
commit0f16511df2531d4d1d15434855bdd96b38021836 (patch)
tree25a901c8652f208947309cb2a56478bf6da2bbe0 /internal/bufpool/buffers_test.go
parentobjectstore/packed: Don't use full delta reconstruction just to read headers (diff)
signatureNo signature
bufpool: Fix lints
Diffstat (limited to 'internal/bufpool/buffers_test.go')
-rw-r--r--internal/bufpool/buffers_test.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/internal/bufpool/buffers_test.go b/internal/bufpool/buffers_test.go
index f5c006da..a690aad1 100644
--- a/internal/bufpool/buffers_test.go
+++ b/internal/bufpool/buffers_test.go
@@ -1,8 +1,11 @@
+//nolint:testpackage
package bufpool
import "testing"
func TestBorrowBufferResizeAndAppend(t *testing.T) {
+ t.Parallel()
+
b := Borrow(1)
defer b.Release()
@@ -31,6 +34,8 @@ func TestBorrowBufferResizeAndAppend(t *testing.T) {
}
func TestBorrowBufferRelease(t *testing.T) {
+ t.Parallel()
+
b := Borrow(DefaultBufferCap / 2)
b.Append([]byte("data"))
b.Release()
@@ -40,6 +45,8 @@ func TestBorrowBufferRelease(t *testing.T) {
}
func TestBorrowUsesLargerPools(t *testing.T) {
+ t.Parallel()
+
const request = DefaultBufferCap * 4
classIdx, classCap, pooled := classFor(request)
@@ -48,7 +55,7 @@ func TestBorrowUsesLargerPools(t *testing.T) {
}
b := Borrow(request)
- if b.pool != poolIndex(classIdx) {
+ if b.pool != poolIndex(classIdx) { //#nosec:G115
t.Fatalf("expected pooled buffer in class %d, got %d", classIdx, b.pool)
}
if cap(b.buf) != classCap {
@@ -58,7 +65,7 @@ func TestBorrowUsesLargerPools(t *testing.T) {
b2 := Borrow(request)
defer b2.Release()
- if b2.pool != poolIndex(classIdx) {
+ if b2.pool != poolIndex(classIdx) { //#nosec:G115
t.Fatalf("expected pooled buffer in class %d on reuse, got %d", classIdx, b2.pool)
}
if cap(b2.buf) != classCap {
@@ -67,6 +74,8 @@ func TestBorrowUsesLargerPools(t *testing.T) {
}
func TestGrowingBufferStaysPooled(t *testing.T) {
+ t.Parallel()
+
b := Borrow(DefaultBufferCap)
defer b.Release()