From 9185d23cb6e10a2f1fbba8a09325bc96eed79340 Mon Sep 17 00:00:00 2001 From: Anatoli Beliaev Date: Mon, 31 Aug 2020 01:10:51 -0700 Subject: [PATCH 1/2] Pass log content instead of file name: DurableTimerClient --- .../DurableEndToEndTests.cs | 15 ++------------- .../DurableTimerOrchestrator/run.ps1 | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/DurableEndToEndTests.cs b/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/DurableEndToEndTests.cs index 1e759f98..3e344b9e 100644 --- a/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/DurableEndToEndTests.cs +++ b/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/DurableEndToEndTests.cs @@ -239,19 +239,8 @@ private async Task DurableTimerClientStopsOrchestratorAndUpdatesCurrentUtcDateTi { var statusResponseBody = await GetResponseBodyAsync(statusResponse); Assert.Equal("Completed", (string)statusResponseBody.runtimeStatus); - string path = statusResponseBody.output.ToString(); - string lastFolderName = Path.GetDirectoryName(path); - - if (!Directory.Exists(lastFolderName)) - { - Assert.True(false, $@"The directory {lastFolderName} does not exist! - The system's value for TMP is {System.Environment.GetEnvironmentVariable("TMP", EnvironmentVariableTarget.Machine)}. - The user's value for TMP is {System.Environment.GetEnvironmentVariable("TMP")}. - The system's value for TEMP is {System.Environment.GetEnvironmentVariable("TEMP", EnvironmentVariableTarget.Machine)}. - The user's value for TEMP is {System.Environment.GetEnvironmentVariable("TEMP")}"); - } - - string[] lines = System.IO.File.ReadAllLines(path); + string log = statusResponseBody.output.ToString(); + string[] lines = log.Split('\n'); // Expect the format to be as in Case 1 var delineatorLines = new int[] { 0, 2 }; diff --git a/test/E2E/TestFunctionApp/DurableTimerOrchestrator/run.ps1 b/test/E2E/TestFunctionApp/DurableTimerOrchestrator/run.ps1 index 619ae033..e5057bc1 100644 --- a/test/E2E/TestFunctionApp/DurableTimerOrchestrator/run.ps1 +++ b/test/E2E/TestFunctionApp/DurableTimerOrchestrator/run.ps1 @@ -24,7 +24,7 @@ Add-Content -Value $Context.CurrentUtcDateTime -Path $path Write-Host "DurableTimerOrchestrator: finished." -return $path +return (Get-Content $path) -join "`n" <# Contents of the file should resemble the following: From 5d0dd4f14826c5fceb154cfd1b8bba2a410836c0 Mon Sep 17 00:00:00 2001 From: Anatoli Beliaev Date: Mon, 31 Aug 2020 14:18:27 -0700 Subject: [PATCH 2/2] Pass log content instead of file name: CurrentUtcDateTimeClient --- .../DurableEndToEndTests.cs | 15 ++------------- .../CurrentUtcDateTimeOrchestrator/run.ps1 | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/DurableEndToEndTests.cs b/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/DurableEndToEndTests.cs index 3e344b9e..dfedab20 100644 --- a/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/DurableEndToEndTests.cs +++ b/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/DurableEndToEndTests.cs @@ -147,19 +147,8 @@ public async Task CurrentUtcDateTimeClientReplaysCurrentUtcDateTime() { var statusResponseBody = await GetResponseBodyAsync(statusResponse); Assert.Equal("Completed", (string)statusResponseBody.runtimeStatus); - string path = statusResponseBody.output.ToString(); - string lastFolderName = Path.GetDirectoryName(path); - - if (!Directory.Exists(lastFolderName)) - { - Assert.True(false, $@"The directory {lastFolderName} does not exist! - The system's value for TMP is {System.Environment.GetEnvironmentVariable("TMP", EnvironmentVariableTarget.Machine)}. - The user's value for TMP is {System.Environment.GetEnvironmentVariable("TMP")}. - The system's value for TEMP is {System.Environment.GetEnvironmentVariable("TEMP", EnvironmentVariableTarget.Machine)}. - The user's value for TEMP is {System.Environment.GetEnvironmentVariable("TEMP")}"); - } - - string[] lines = System.IO.File.ReadAllLines(path); + string log = statusResponseBody.output.ToString(); + string[] lines = log.Split('\n'); // Expect the format to be as in Case 1 var delineatorLines = new int[] { 0, 3, 9 }; diff --git a/test/E2E/TestFunctionApp/CurrentUtcDateTimeOrchestrator/run.ps1 b/test/E2E/TestFunctionApp/CurrentUtcDateTimeOrchestrator/run.ps1 index 4d8aa6d4..9011b361 100644 --- a/test/E2E/TestFunctionApp/CurrentUtcDateTimeOrchestrator/run.ps1 +++ b/test/E2E/TestFunctionApp/CurrentUtcDateTimeOrchestrator/run.ps1 @@ -50,7 +50,7 @@ Add-Content -Value $Context.CurrentUtcDateTime -Path $path Write-Host "CurrentUtcDateTimeOrchestrator: finished." -return $path +return (Get-Content $path) -join "`n" <# Contents of the file should resemble one of the following two cases: