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

@@ -13,7 +13,7 @@ import (
func TestSafelyHandleMessage(t *testing.T) {
hook := logTest.NewGlobal()
messagehandler.SafelyHandleMessage(context.Background(), func(_ context.Context, _ *pubsub.Message) error {
messagehandler.SafelyHandleMessage(t.Context(), func(_ context.Context, _ *pubsub.Message) error {
panic("bad!")
return nil
}, &pubsub.Message{})
@@ -24,7 +24,7 @@ func TestSafelyHandleMessage(t *testing.T) {
func TestSafelyHandleMessage_NoData(t *testing.T) {
hook := logTest.NewGlobal()
messagehandler.SafelyHandleMessage(context.Background(), func(_ context.Context, _ *pubsub.Message) error {
messagehandler.SafelyHandleMessage(t.Context(), func(_ context.Context, _ *pubsub.Message) error {
panic("bad!")
return nil
}, nil)