Skip to content

Commit d980663

Browse files
authored
Fix flaky E2E durable tests (#532)
* Pass log content instead of file name: DurableTimerClient * Pass log content instead of file name: CurrentUtcDateTimeClient
1 parent 905f353 commit d980663

File tree

3 files changed

+6
-28
lines changed
  • test/E2E

3 files changed

+6
-28
lines changed

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

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -147,19 +147,8 @@ public async Task CurrentUtcDateTimeClientReplaysCurrentUtcDateTime()
147147
{
148148
var statusResponseBody = await GetResponseBodyAsync(statusResponse);
149149
Assert.Equal("Completed", (string)statusResponseBody.runtimeStatus);
150-
string path = statusResponseBody.output.ToString();
151-
string lastFolderName = Path.GetDirectoryName(path);
152-
153-
if (!Directory.Exists(lastFolderName))
154-
{
155-
Assert.True(false, $@"The directory {lastFolderName} does not exist!
156-
The system's value for TMP is {System.Environment.GetEnvironmentVariable("TMP", EnvironmentVariableTarget.Machine)}.
157-
The user's value for TMP is {System.Environment.GetEnvironmentVariable("TMP")}.
158-
The system's value for TEMP is {System.Environment.GetEnvironmentVariable("TEMP", EnvironmentVariableTarget.Machine)}.
159-
The user's value for TEMP is {System.Environment.GetEnvironmentVariable("TEMP")}");
160-
}
161-
162-
string[] lines = System.IO.File.ReadAllLines(path);
150+
string log = statusResponseBody.output.ToString();
151+
string[] lines = log.Split('\n');
163152

164153
// Expect the format to be as in Case 1
165154
var delineatorLines = new int[] { 0, 3, 9 };
@@ -239,19 +228,8 @@ private async Task DurableTimerClientStopsOrchestratorAndUpdatesCurrentUtcDateTi
239228
{
240229
var statusResponseBody = await GetResponseBodyAsync(statusResponse);
241230
Assert.Equal("Completed", (string)statusResponseBody.runtimeStatus);
242-
string path = statusResponseBody.output.ToString();
243-
string lastFolderName = Path.GetDirectoryName(path);
244-
245-
if (!Directory.Exists(lastFolderName))
246-
{
247-
Assert.True(false, $@"The directory {lastFolderName} does not exist!
248-
The system's value for TMP is {System.Environment.GetEnvironmentVariable("TMP", EnvironmentVariableTarget.Machine)}.
249-
The user's value for TMP is {System.Environment.GetEnvironmentVariable("TMP")}.
250-
The system's value for TEMP is {System.Environment.GetEnvironmentVariable("TEMP", EnvironmentVariableTarget.Machine)}.
251-
The user's value for TEMP is {System.Environment.GetEnvironmentVariable("TEMP")}");
252-
}
253-
254-
string[] lines = System.IO.File.ReadAllLines(path);
231+
string log = statusResponseBody.output.ToString();
232+
string[] lines = log.Split('\n');
255233

256234
// Expect the format to be as in Case 1
257235
var delineatorLines = new int[] { 0, 2 };

test/E2E/TestFunctionApp/CurrentUtcDateTimeOrchestrator/run.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Add-Content -Value $Context.CurrentUtcDateTime -Path $path
5050

5151
Write-Host "CurrentUtcDateTimeOrchestrator: finished."
5252

53-
return $path
53+
return (Get-Content $path) -join "`n"
5454

5555
<#
5656
Contents of the file should resemble one of the following two cases:

test/E2E/TestFunctionApp/DurableTimerOrchestrator/run.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Add-Content -Value $Context.CurrentUtcDateTime -Path $path
2424

2525
Write-Host "DurableTimerOrchestrator: finished."
2626

27-
return $path
27+
return (Get-Content $path) -join "`n"
2828

2929
<#
3030
Contents of the file should resemble the following:

0 commit comments

Comments
 (0)