Replace context.Background with testing.TB.Context where possible (#15416)

* Replace context.Background with testing.TB.Context where possible

* Fix failing tests
This commit is contained in:
Preston Van Loon
2025-06-16 17:09:18 -05:00
committed by GitHub
parent 6a13ba9125
commit 62fec4d1f3
409 changed files with 3175 additions and 3456 deletions

View File

@@ -3,7 +3,6 @@ package rpc
import (
"archive/zip"
"bytes"
"context"
"encoding/base64"
"encoding/json"
"fmt"
@@ -37,7 +36,7 @@ var (
)
func TestServer_ListAccounts(t *testing.T) {
ctx := context.Background()
ctx := t.Context()
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
// We attempt to create the wallet.
@@ -142,7 +141,7 @@ func TestServer_ListAccounts(t *testing.T) {
}
func TestServer_BackupAccounts(t *testing.T) {
ctx := context.Background()
ctx := t.Context()
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
// We attempt to create the wallet.
@@ -235,7 +234,7 @@ func TestServer_BackupAccounts(t *testing.T) {
func TestServer_VoluntaryExit(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
ctx := context.Background()
ctx := t.Context()
mockValidatorClient := validatormock.NewMockValidatorClient(ctrl)
mockNodeClient := validatormock.NewMockNodeClient(ctrl)