Go: fix context (#18118)

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-08-11 19:19:29 +08:00
committed by GitHub
parent 8bd5768ebc
commit c75edbfbe8
36 changed files with 492 additions and 352 deletions

View File

@@ -27,7 +27,6 @@
package component
import (
"context"
"testing"
)
@@ -84,7 +83,8 @@ func TestLoop_InvokeIsNoOp(t *testing.T) {
{"variable": "counter", "input_mode": "constant", "value": 7, "type": "number"},
},
})
out, err := c.Invoke(context.Background(), nil, map[string]any{"in": 1})
ctx := t.Context()
out, err := c.Invoke(ctx, nil, map[string]any{"in": 1})
if err != nil {
t.Fatalf("Invoke: %v", err)
}
@@ -97,7 +97,8 @@ func TestLoop_InvokeIsNoOp(t *testing.T) {
// empty-map chunk and closes.
func TestLoop_StreamMirrorsInvoke(t *testing.T) {
c := NewLoopComponent(loopParam{})
ch, err := c.Stream(context.Background(), nil, nil)
ctx := t.Context()
ch, err := c.Stream(ctx, nil, nil)
if err != nil {
t.Fatalf("Stream: %v", err)
}