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:
Boris Nagaev
2025-08-19 14:54:41 -03:00
parent 6ffe257004
commit dee8ad3754
71 changed files with 361 additions and 393 deletions

View File

@@ -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,
}