mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-19 12:01:27 +02:00
multi: context.Background() -> t.Context()
Use the new feature of Go 1.24, fix linter warnings. This change was produced by: - running golangci-lint run --fix - sed 's/context.Background/t.Context/' -i `git grep -l context.Background | grep test.go` - manually fixing broken tests - itest, lntest: use ht.Context() where ht or hn is available - in HarnessNode.Stop() we keep using context.Background(), because it is called from a cleanup handler in which t.Context() is canceled already.
This commit is contained in:
@@ -18,7 +18,7 @@ import (
|
||||
func TestExecuteBatchQuery(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
t.Run("empty input returns nil", func(t *testing.T) {
|
||||
var (
|
||||
@@ -245,7 +245,7 @@ func TestExecuteBatchQuery(t *testing.T) {
|
||||
// executing the query in pages.
|
||||
func TestSQLSliceQueries(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
db := NewTestDB(t)
|
||||
|
||||
@@ -327,7 +327,7 @@ func TestSQLSliceQueries(t *testing.T) {
|
||||
// page until all items are processed or an error occurs.
|
||||
func TestExecutePaginatedQuery(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
type testItem struct {
|
||||
id int64
|
||||
@@ -944,7 +944,7 @@ func TestExecuteCollectAndBatchWithSharedDataQuery(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &QueryConfig{
|
||||
MaxPageSize: tt.maxPageSize,
|
||||
}
|
||||
|
Reference in New Issue
Block a user