Add Run control event stream
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user