package runner import ( "testing" "time" "github.com/easyai/easyai-ai-gateway/apps/api/internal/executionpool" "github.com/easyai/easyai-ai-gateway/apps/api/internal/store" ) func TestWorkerCapabilityNegotiationRejectsLegacyDescriptor(t *testing.T) { worker := executionpool.WorkerDescriptor{ ProtocolVersion: executionpool.ProtocolVersion, Allocated: 1, SafeCapacity: 1, Capabilities: map[string]any{}, HeartbeatAt: time.Now(), } if workerCapabilityMatched([]executionpool.WorkerDescriptor{worker}, store.GatewayTask{Kind: "images.generations"}) { t.Fatal("legacy worker without taskKinds capability was accepted") } worker.Capabilities = map[string]any{"taskKinds": []any{"images.*"}} if !workerCapabilityMatched([]executionpool.WorkerDescriptor{worker}, store.GatewayTask{Kind: "images.generations"}) { t.Fatal("compatible worker was rejected") } }