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 committed 2025-08-30 14:13:44 -03:00
1 parent 6ffe257004
commit dee8ad3754
71 files changed
+361 -393

No files matched your search

+3 -3
View File
@@ -132,7 +132,7 @@ func createTestCtxFromGraphInstanceAssumeValid(t *testing.T,
)
require.NoError(t, err)
sourceNode, err := graphInstance.graph.SourceNode(context.Background())
sourceNode, err := graphInstance.graph.SourceNode(t.Context())
require.NoError(t, err)
sessionSource := &SessionSource{
GraphSessionFactory: graphInstance.graph,
@@ -1202,7 +1202,7 @@ func TestFindPathFeeWeighting(t *testing.T) {
var preImage [32]byte
copy(preImage[:], bytes.Repeat([]byte{9}, 32))
sourceNode, err := ctx.graph.SourceNode(context.Background())
sourceNode, err := ctx.graph.SourceNode(t.Context())
require.NoError(t, err, "unable to fetch source node")
amt := lnwire.MilliSatoshi(100)
@@ -2706,7 +2706,7 @@ func TestNewRouteRequest(t *testing.T) {
// announcements for the channel vertexes to be able to use the channel.
func TestAddEdgeUnknownVertexes(t *testing.T) {
t.Parallel()
ctxb := context.Background()
ctxb := t.Context()
const startingBlockHeight = 101
ctx := createTestCtxFromFile(t, startingBlockHeight, basicGraphFilePath)