Files
tasks/pkg/sdk/worker/interrupt_ch_test.go
zeekay 072ecefbfe feat(sdk): close caller-symbol gap for base/commerce migration
Adds every symbol hanzoai/base/plugins/tasks and hanzoai/commerce
call today that was missing from pkg/sdk/*: SignalWithStartWorkflow,
GetWorkflow, QueryWorkflow, CheckHealth, WorkflowRunGetOptions +
WorkflowRun.GetWithOptions, ExecuteChildWorkflow + ChildWorkflowFuture,
LocalActivityOptions + WithLocalActivityOptions + ExecuteLocalActivity
(Phase-1 remote-path), worker.InterruptCh(), worker.Options rate-limit
fields wired via golang.org/x/time/rate.

New opcodes 0x0066 signalWithStartWorkflow / 0x0067 queryWorkflow
land here; frontend-side handlers were wired in PR-A via the
translate.go dispatch table.

Closes red-review §2 gap table. Dry-run base migration compiles.
2026-04-23 12:53:15 -07:00

34 lines
842 B
Go

// Copyright © 2026 Hanzo AI. MIT License.
package worker
import (
"testing"
"time"
)
// TestInterruptChSameInstance confirms repeated calls return the same
// channel — callers that wire a worker chain across N Run calls all
// observe the same interrupt signal.
func TestInterruptChSameInstance(t *testing.T) {
t.Parallel()
a := InterruptCh()
b := InterruptCh()
if a != b {
t.Fatal("InterruptCh must return the same channel on repeated calls")
}
}
// TestInterruptChShape checks the returned channel matches the type
// expected by Worker.Run (<-chan any).
func TestInterruptChShape(t *testing.T) {
t.Parallel()
ch := InterruptCh()
// Drain non-blocking to verify the channel is receivable.
select {
case <-ch:
t.Fatal("InterruptCh must not be closed at construction")
case <-time.After(10 * time.Millisecond):
}
}