Skip to content

Commit aabc430

Browse files
author
Michael Peng
committed
Fixed issue where orchestrations that never complete cause E2E tests to run indefinitely
1 parent f0302c9 commit aabc430

File tree

2 files changed

+19
-4
lines changed
  • test/E2E

2 files changed

+19
-4
lines changed

test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/DurableEndToEndTests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ public async Task CurrentUtcDateTimeClientReplaysCurrentUtcDateTime()
140140
{
141141
case HttpStatusCode.Accepted:
142142
{
143+
if (DateTime.UtcNow > startTime + orchestrationCompletionTimeout)
144+
{
145+
Assert.True(false, $"The orchestration has not completed after {orchestrationCompletionTimeout}");
146+
}
147+
143148
await Task.Delay(TimeSpan.FromSeconds(2));
144149
break;
145150
}
@@ -232,6 +237,11 @@ private async Task DurableTimerClientStopsOrchestratorAndUpdatesCurrentUtcDateTi
232237
{
233238
case HttpStatusCode.Accepted:
234239
{
240+
if (DateTime.UtcNow > startTime + orchestrationCompletionTimeout)
241+
{
242+
Assert.True(false, $"The orchestration has not completed after {orchestrationCompletionTimeout}");
243+
}
244+
235245
await Task.Delay(TimeSpan.FromSeconds(2));
236246
break;
237247
}
@@ -296,6 +306,11 @@ private async Task ExternalEventClientSendsExternalEvents() {
296306
{
297307
case HttpStatusCode.Accepted:
298308
{
309+
if (DateTime.UtcNow > startTime + orchestrationCompletionTimeout)
310+
{
311+
Assert.True(false, $"The orchestration has not completed after {orchestrationCompletionTimeout}");
312+
}
313+
299314
await Task.Delay(TimeSpan.FromSeconds(2));
300315
break;
301316
}

test/E2E/TestFunctionApp/ExternalEventOrchestrator/run.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ $firstDuration = New-TimeSpan -Seconds $Context.Input.FirstDuration
1212
$secondDuration = New-TimeSpan -Seconds $Context.Input.SecondDuration
1313

1414
$firstTimeout = Start-DurableTimer -Duration $firstDuration -NoWait
15-
$firstExternalEvent = Start-DurableExternalEventListener -EventName "FirstExternalEvent"
16-
$firstCompleted = Wait-DurableTask -Task @($firstTimeout, $firstExternalEvent)
15+
$firstExternalEvent = Start-DurableExternalEventListener -EventName "FirstExternalEvent" -NoWait
16+
$firstCompleted = Wait-DurableTask -Task @($firstTimeout, $firstExternalEvent) -Any
1717

1818
if ($firstCompleted -eq $firstTimeout) {
1919
$output += "FirstTimeout"
@@ -24,8 +24,8 @@ else {
2424
}
2525

2626
$secondTimeout = Start-DurableTimer -Duration $secondDuration -NoWait
27-
$secondExternalEvent = Start-DurableExternalEventListener -EventName "SecondExternalEvent"
28-
$secondCompleted = Wait-DurableTask -Task @($secondTimeout, $secondExternalEvent)
27+
$secondExternalEvent = Start-DurableExternalEventListener -EventName "SecondExternalEvent" -NoWait
28+
$secondCompleted = Wait-DurableTask -Task @($secondTimeout, $secondExternalEvent) -Any
2929

3030
if ($secondCompleted -eq $secondTimeout) {
3131
$output += "SecondTimeout"

0 commit comments

Comments
 (0)