feat: expose executor job observability
This commit is contained in:
@@ -57,6 +57,10 @@ test('orchestrator HTTP API exposes health and authenticated run endpoints', asy
|
||||
body: JSON.stringify(spec()),
|
||||
});
|
||||
assert.equal(unauthorized.status, 401);
|
||||
const unauthorizedExecutorJob = await fetch(
|
||||
`${server.baseUrl}/v1/executor-jobs/http-shadow-1%3Aexecutor-preview`,
|
||||
);
|
||||
assert.equal(unauthorizedExecutorJob.status, 401);
|
||||
|
||||
const created = await fetch(`${server.baseUrl}/v1/runs`, {
|
||||
method: 'POST',
|
||||
@@ -75,6 +79,26 @@ test('orchestrator HTTP API exposes health and authenticated run endpoints', asy
|
||||
const eventBody = await events.json();
|
||||
assert.equal(events.status, 200);
|
||||
assert.deepEqual(eventBody.events.map((event) => event.sequence), [2, 3]);
|
||||
|
||||
const jobId = 'http-shadow-1:executor-preview';
|
||||
const executorJob = await fetch(
|
||||
`${server.baseUrl}/v1/executor-jobs/${encodeURIComponent(jobId)}`,
|
||||
{ headers: { authorization: 'Bearer test-service-token' } },
|
||||
);
|
||||
assert.equal(executorJob.status, 200);
|
||||
assert.equal((await executorJob.json()).status, 'blocked');
|
||||
|
||||
const executorEvents = await fetch(
|
||||
`${server.baseUrl}/v1/executor-jobs/${encodeURIComponent(jobId)}/events?after=0`,
|
||||
{ headers: { authorization: 'Bearer test-service-token' } },
|
||||
);
|
||||
const executorEventBody = await executorEvents.json();
|
||||
assert.equal(executorEvents.status, 200);
|
||||
assert.deepEqual(
|
||||
executorEventBody.events.map((event) => event.type),
|
||||
['executor_job_blocked'],
|
||||
);
|
||||
assert.equal(executorEventBody.nextCursor, 1);
|
||||
});
|
||||
|
||||
test('orchestrator HTTP API reports missing runs and observe-only violations', async (t) => {
|
||||
@@ -86,6 +110,9 @@ test('orchestrator HTTP API reports missing runs and observe-only violations', a
|
||||
|
||||
const missing = await fetch(`${server.baseUrl}/v1/runs/missing`);
|
||||
assert.equal(missing.status, 404);
|
||||
const missingExecutorJob = await fetch(`${server.baseUrl}/v1/executor-jobs/missing`);
|
||||
assert.equal(missingExecutorJob.status, 404);
|
||||
assert.equal((await missingExecutorJob.json()).error.code, 'EXECUTOR_JOB_NOT_FOUND');
|
||||
|
||||
const activeSpec = spec();
|
||||
activeSpec.runId = 'http-active-1';
|
||||
|
||||
Reference in New Issue
Block a user