Skip to content

Commit 2061207

Browse files
Michael Pengmichaelpeng36
authored andcommitted
Fixed issue where orchestrations that never complete cause E2E tests to run indefinitely
1 parent df5c9f3 commit 2061207

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
}
@@ -221,6 +226,11 @@ private async Task DurableTimerClientStopsOrchestratorAndUpdatesCurrentUtcDateTi
221226
{
222227
case HttpStatusCode.Accepted:
223228
{
229+
if (DateTime.UtcNow > startTime + orchestrationCompletionTimeout)
230+
{
231+
Assert.True(false, $"The orchestration has not completed after {orchestrationCompletionTimeout}");
232+
}
233+
224234
await Task.Delay(TimeSpan.FromSeconds(2));
225235
break;
226236
}
@@ -274,6 +284,11 @@ private async Task ExternalEventClientSendsExternalEvents() {
274284
{
275285
case HttpStatusCode.Accepted:
276286
{
287+
if (DateTime.UtcNow > startTime + orchestrationCompletionTimeout)
288+
{
289+
Assert.True(false, $"The orchestration has not completed after {orchestrationCompletionTimeout}");
290+
}
291+
277292
await Task.Delay(TimeSpan.FromSeconds(2));
278293
break;
279294
}

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)