From 5c25028b88019fb1054434267bae3cd2d3ef2cfa Mon Sep 17 00:00:00 2001 From: alliscode Date: Mon, 11 Nov 2024 14:33:08 -0800 Subject: [PATCH] trying more --- .../AssemblyInfo.cs | 1 + .../ProcessTestFixture.cs | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/AssemblyInfo.cs diff --git a/dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/AssemblyInfo.cs b/dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/AssemblyInfo.cs new file mode 100644 index 000000000000..e38d6e8453dc --- /dev/null +++ b/dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/AssemblyInfo.cs @@ -0,0 +1 @@ +[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] diff --git a/dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/ProcessTestFixture.cs b/dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/ProcessTestFixture.cs index f90e4daa6936..d044c1cacbc2 100644 --- a/dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/ProcessTestFixture.cs +++ b/dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/ProcessTestFixture.cs @@ -14,7 +14,6 @@ public sealed class ProcessTestFixture : IDisposable, IAsyncLifetime { private System.Diagnostics.Process? _process; private HttpClient? _httpClient; - private string? _daprAppIdd; /// /// Called by xUnit before the test is run. @@ -22,7 +21,11 @@ public sealed class ProcessTestFixture : IDisposable, IAsyncLifetime /// public async Task InitializeAsync() { - this._daprAppIdd = Guid.NewGuid().ToString("n"); + if (this._process is not null && !this._process.HasExited) + { + return; + } + this._httpClient = new HttpClient(); await this.StartTestHostAsync(); } @@ -35,11 +38,11 @@ private async Task StartTestHostAsync() { try { - string workingDirectory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"../../../../Process.IntegrationTestHost.Dapr")); + string workingDirectory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "../../../../Process.IntegrationTestHost.Dapr")); var processStartInfo = new ProcessStartInfo { FileName = "dapr", - Arguments = $"run --app-id {this._daprAppIdd!} --app-port 5200 --dapr-http-port 3500 -- dotnet run --urls http://localhost:5200", + Arguments = $"run --app-id daprprocesstests --app-port 5200 --dapr-http-port 3500 -- dotnet run --urls http://localhost:5200", WorkingDirectory = workingDirectory, RedirectStandardOutput = false, RedirectStandardError = false, @@ -66,7 +69,7 @@ private async Task ShutdownTestHostAsync() var processStartInfo = new ProcessStartInfo { FileName = "dapr", - Arguments = $"stop --app-id {this._daprAppIdd}", + Arguments = $"stop --app-id daprprocesstests", RedirectStandardOutput = false, RedirectStandardError = false, UseShellExecute = true,