Add Run control event stream

This commit is contained in:
npc0-hue
2026-08-26 23:06:06 +08:00
parent 6369a8099a
commit 55a5d6de80
10 changed files with 274 additions and 3 deletions
+18
View File
@@ -128,6 +128,24 @@ func TestCoreServiceRunJobClaimWithWaitWakesOnCreate(t *testing.T) {
}
}
func TestCoreServiceRunControlSubscriptionWakesOnCreateJob(t *testing.T) {
svc, sessionToken := newRegisteredRunJobService(t)
subscription, err := svc.SubscribeRunControlEvents(domain.RunControlStreamRequest{RunEndpointID: "run-local", SessionToken: sessionToken})
if err != nil {
t.Fatalf("subscribe control events: %v", err)
}
defer subscription.Cancel()
createQueuedRunJob(t, svc, "job-control-wake", "idem-control-wake")
select {
case event := <-subscription.Events:
if event.Type != domain.RunControlEventTypeJobChanged || event.RunEndpointID != "run-local" || event.Sequence == 0 {
t.Fatalf("unexpected control event: %+v", event)
}
case <-time.After(time.Second):
t.Fatal("timed out waiting for control wake event")
}
}
func TestCoreServiceRunJobClaimSkipsServerFileCapabilityWithoutDeclaration(t *testing.T) {
svc := newTestCoreService()
plugin, endpoint := createPluginAndRunEndpoint(t, svc)