Skip to content

Commit ebdf7df

Browse files
committed
use t.context
1 parent 76777d2 commit ebdf7df

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

transaction/chaintracker/whatsonchain_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package chaintracker
44

55
import (
6-
"context"
76
"encoding/json"
87
"net/http"
98
"net/http/httptest"
@@ -54,7 +53,7 @@ func TestWhatsOnChainGetBlockHeaderSuccess(t *testing.T) {
5453
client: ts.Client(),
5554
}
5655

57-
ctx := context.Background()
56+
ctx := t.Context()
5857
header, err := woc.GetBlockHeader(ctx, 100)
5958
if err != nil {
6059
t.Fatalf("expected no error, got %v", err)
@@ -83,7 +82,7 @@ func TestWhatsOnChainGetBlockHeaderNotFound(t *testing.T) {
8382
client: ts.Client(),
8483
}
8584

86-
ctx := context.Background()
85+
ctx := t.Context()
8786
header, err := woc.GetBlockHeader(ctx, 100)
8887
if err != nil {
8988
t.Fatalf("expected no error, got %v", err)
@@ -108,7 +107,7 @@ func TestWhatsOnChainGetBlockHeaderErrorResponse(t *testing.T) {
108107
client: ts.Client(),
109108
}
110109

111-
ctx := context.Background()
110+
ctx := t.Context()
112111
header, err := woc.GetBlockHeader(ctx, 100)
113112
if err == nil {
114113
t.Fatalf("expected error, got nil")
@@ -140,7 +139,7 @@ func TestWhatsOnChainIsValidRootForHeightSuccess(t *testing.T) {
140139
client: ts.Client(),
141140
}
142141

143-
ctx := context.Background()
142+
ctx := t.Context()
144143
isValid, err := woc.IsValidRootForHeight(ctx, &merkleRootHash, 100)
145144
if err != nil {
146145
t.Fatalf("expected no error, got %v", err)
@@ -173,7 +172,7 @@ func TestWhatsOnChainIsValidRootForHeightInvalidRoot(t *testing.T) {
173172
client: ts.Client(),
174173
}
175174

176-
ctx := context.Background()
175+
ctx := t.Context()
177176
isValid, err := woc.IsValidRootForHeight(ctx, &differentMerkleRootHash, 100)
178177
if err != nil {
179178
t.Fatalf("expected no error, got %v", err)

0 commit comments

Comments
 (0)