diff --git a/cmd/any2anexoj-cli/pretty_printer_test.go b/cmd/any2anexoj-cli/pretty_printer_test.go index 48cb3ca..72db220 100644 --- a/cmd/any2anexoj-cli/pretty_printer_test.go +++ b/cmd/any2anexoj-cli/pretty_printer_test.go @@ -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{ diff --git a/internal/aggregator_writer_test.go b/internal/aggregator_writer_test.go index aab8dc4..9936b55 100644 --- a/internal/aggregator_writer_test.go +++ b/internal/aggregator_writer_test.go @@ -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 diff --git a/internal/ofigi/client_test.go b/internal/ofigi/client_test.go index 052a23c..a203c8b 100644 --- a/internal/ofigi/client_test.go +++ b/internal/ofigi/client_test.go @@ -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)