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:
71 files changed
+361
-393
No files matched your search
@@ -220,7 +220,7 @@ func middlewareInterceptionTest(t *testing.T,
|
||||
|
||||
// Everything we test here should be executed in a matter of
|
||||
// milliseconds, so we can use one single timeout context for all calls.
|
||||
ctxb := context.Background()
|
||||
ctxb := t.Context()
|
||||
ctxc, cancel := context.WithTimeout(ctxb, defaultTimeout)
|
||||
defer cancel()
|
||||
|
||||
@@ -372,7 +372,7 @@ func middlewareResponseManipulationTest(t *testing.T,
|
||||
|
||||
// Everything we test here should be executed in a matter of
|
||||
// milliseconds, so we can use one single timeout context for all calls.
|
||||
ctxb := context.Background()
|
||||
ctxb := t.Context()
|
||||
ctxc, cancel := context.WithTimeout(ctxb, defaultTimeout)
|
||||
defer cancel()
|
||||
|
||||
@@ -489,7 +489,7 @@ func middlewareRequestManipulationTest(t *testing.T, node *node.HarnessNode,
|
||||
|
||||
// Everything we test here should be executed in a matter of
|
||||
// milliseconds, so we can use one single timeout context for all calls.
|
||||
ctxb := context.Background()
|
||||
ctxb := t.Context()
|
||||
ctxc, cancel := context.WithTimeout(ctxb, defaultTimeout)
|
||||
defer cancel()
|
||||
|
||||
@@ -582,7 +582,7 @@ func middlewareMandatoryTest(ht *lntest.HarnessTest, node *node.HarnessNode) {
|
||||
err = node.WaitUntilServerActive()
|
||||
require.NoError(ht, err)
|
||||
|
||||
ctxb := context.Background()
|
||||
ctxb := ht.Context()
|
||||
ctxc, cancel := context.WithTimeout(ctxb, defaultTimeout)
|
||||
defer cancel()
|
||||
|
||||
|
||||
Reference in new issue
Block a user