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
+1 -2
View File
@@ -2,7 +2,6 @@ package main
import (
"bytes"
"context"
"testing"
"time"
@@ -13,7 +12,7 @@ import (
func TestPrettyPrinter_Render(t *testing.T) {
// Create test data
aw := internal.NewAggregatorWriter()
ctx := context.Background()
ctx := t.Context()
// Add some sample report items
err := aw.Write(ctx, internal.ReportItem{
+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
+1 -2
View File
@@ -2,7 +2,6 @@ package ofigi_test
import (
"bytes"
"context"
"fmt"
"io"
"net/http"
@@ -112,7 +111,7 @@ func TestOpenFIGI_SecurityTypeByISIN(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
of := ofigi.NewOpenFIGI(tt.client, "")
got, gotErr := of.SecurityTypeByISIN(context.Background(), tt.isin)
got, gotErr := of.SecurityTypeByISIN(t.Context(), tt.isin)
if gotErr != nil {
if !tt.wantErr {
t.Errorf("want success but failed: %v", gotErr)