Skip to content

Commit 14efe07

Browse files
committed
status test update
1 parent 16f9246 commit 14efe07

File tree

1 file changed

+12
-30
lines changed

1 file changed

+12
-30
lines changed

test/e2e-azuremanaged/orchestration.spec.ts

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -583,14 +583,9 @@ describe("Durable Task Scheduler (DTS) E2E Tests", () => {
583583

584584
it("should set and retrieve custom status", async () => {
585585
const orchestrator: TOrchestrator = async function* (ctx: OrchestrationContext): any {
586-
ctx.setCustomStatus("Step 1: Starting");
587-
yield ctx.createTimer(1);
588-
589-
// Use longer timer to give CI environments more time to observe this status
590-
ctx.setCustomStatus({ step: 2, message: "Processing" });
591-
yield ctx.createTimer(5);
592-
593-
ctx.setCustomStatus("Step 3: Completed");
586+
ctx.setCustomStatus("Processing");
587+
yield ctx.createTimer(10);
588+
ctx.setCustomStatus("Completed");
594589
return "done";
595590
};
596591

@@ -599,38 +594,25 @@ describe("Durable Task Scheduler (DTS) E2E Tests", () => {
599594

600595
const id = await taskHubClient.scheduleNewOrchestration(orchestrator);
601596

602-
// Poll for custom status changes - collect all observed statuses
603-
let foundObjectStatus = false;
604-
const observedStatuses: string[] = [];
597+
// Poll to observe the first status
598+
let foundProcessingStatus = false;
605599
const startTime = Date.now();
606-
while (Date.now() - startTime < 20000) {
600+
while (Date.now() - startTime < 10000) {
607601
const state = await taskHubClient.getOrchestrationState(id);
608-
if (state?.serializedCustomStatus) {
609-
const status = state.serializedCustomStatus;
610-
// Track unique statuses for debugging
611-
if (!observedStatuses.includes(status)) {
612-
observedStatuses.push(status);
613-
}
614-
if (status.includes("step") && status.includes("Processing")) {
615-
foundObjectStatus = true;
616-
break;
617-
}
602+
if (state?.serializedCustomStatus === JSON.stringify("Processing")) {
603+
foundProcessingStatus = true;
604+
break;
618605
}
619-
// Poll more frequently
620606
await new Promise((resolve) => setTimeout(resolve, 200));
621607
}
622608

623609
const finalState = await taskHubClient.waitForOrchestrationCompletion(id, undefined, 30);
624610

625611
expect(finalState).toBeDefined();
626612
expect(finalState?.runtimeStatus).toEqual(OrchestrationStatus.ORCHESTRATION_STATUS_COMPLETED);
627-
expect(finalState?.serializedCustomStatus).toEqual(JSON.stringify("Step 3: Completed"));
628-
// Provide better error message on failure - log observed statuses if assertion fails
629-
if (!foundObjectStatus) {
630-
console.log("Observed statuses during polling:", observedStatuses);
631-
}
632-
expect(foundObjectStatus).toBe(true);
633-
}, 60000);
613+
expect(finalState?.serializedCustomStatus).toEqual(JSON.stringify("Completed"));
614+
expect(foundProcessingStatus).toBe(true);
615+
}, 31000);
634616

635617
it("should update custom status to empty string when explicitly set", async () => {
636618
const orchestrator: TOrchestrator = async function* (ctx: OrchestrationContext): any {

0 commit comments

Comments
 (0)