update tests context

This commit is contained in:
2026-08-02 15:49:22 +01:00
parent a7d5277c7c
commit 6fcc21adfe
3 changed files with 6 additions and 9 deletions
+4 -5
View File
@@ -1,7 +1,6 @@
package internal_test
import (
"context"
"sync"
"testing"
"time"
@@ -91,7 +90,7 @@ func TestAggregatorWriter_Write(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
aw := &internal.AggregatorWriter{}
ctx := context.Background()
ctx := t.Context()
for _, item := range tt.items {
if err := aw.Write(ctx, item); err != nil {
@@ -191,7 +190,7 @@ func TestAggregatorWriter_Rounding(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
aw := &internal.AggregatorWriter{}
ctx := context.Background()
ctx := t.Context()
for _, item := range tt.items {
if err := aw.Write(ctx, item); err != nil {
@@ -209,7 +208,7 @@ func TestAggregatorWriter_Rounding(t *testing.T) {
func TestAggregatorWriter_Items(t *testing.T) {
aw := &internal.AggregatorWriter{}
ctx := context.Background()
ctx := t.Context()
for range 5 {
item := internal.ReportItem{Symbol: "TEST"}
@@ -241,7 +240,7 @@ func TestAggregatorWriter_Items(t *testing.T) {
func TestAggregatorWriter_ThreadSafety(t *testing.T) {
aw := &internal.AggregatorWriter{}
ctx := context.Background()
ctx := t.Context()
numGoroutines := 100
writesPerGoroutine := 100