Skip to content

Commit 4f1f2b3

Browse files
committed
failure test
1 parent 026b7b7 commit 4f1f2b3

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

test/e2e-azuremanaged/entity.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,29 @@ describe("Durable Entities E2E Tests (DTS)", () => {
15091509
// The ping operation should have succeeded
15101510
expect(metadata?.state?.log).toContain("ping");
15111511
}, 30000);
1512+
1513+
it("should fail orchestration when entity call throws an unhandled exception", async () => {
1514+
// Arrange - orchestration that calls an entity operation which throws
1515+
const entityId = new EntityInstanceId("AsyncEntity", `fail-call-${Date.now()}`);
1516+
1517+
taskHubWorker.addNamedEntity("AsyncEntity", () => new AsyncEntity());
1518+
taskHubWorker.addNamedOrchestrator("CallFailingEntity", async function* (ctx): AsyncGenerator<any, any, any> {
1519+
// This call should throw because failOperation throws an error in the entity
1520+
const result = yield ctx.entities.callEntity(entityId, "failOperation");
1521+
return result;
1522+
});
1523+
await taskHubWorker.start();
1524+
1525+
// Act - Start the orchestration
1526+
const instanceId = await taskHubClient.scheduleNewOrchestration("CallFailingEntity");
1527+
1528+
// Wait for orchestration to complete
1529+
const state = await taskHubClient.waitForOrchestrationCompletion(instanceId, undefined, 60);
1530+
1531+
// Assert - Orchestration should be failed
1532+
expect(state?.runtimeStatus).toBe(OrchestrationStatus.ORCHESTRATION_STATUS_FAILED);
1533+
expect(state?.failureDetails?.message).toContain("This operation intentionally fails");
1534+
}, 60000);
15121535
});
15131536

15141537
describe("Scheduled Signal Delivery", () => {

0 commit comments

Comments
 (0)