From 5a3308688153bd28b0ff6bfc0a430176975fa4f6 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Thu, 29 Aug 2024 00:52:13 +0000 Subject: [PATCH] Using collections to disable parallelisation --- .github/workflows/dotnet.yml | 2 +- .../AssemblyInfo.cs | 1 + .../SwaHostingComponentTests.cs | 2 ++ .../AssemblyInfo.cs | 1 + .../{ProgramTests.cs => JavaHostingComponentTests.cs} | 5 +++-- 5 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 tests/CommunityToolkit.Aspire.Hosting.Azure.StaticWebApps.Tests/AssemblyInfo.cs create mode 100644 tests/CommunityToolkit.Aspire.Java.Hosting.EndToEndTests/AssemblyInfo.cs rename tests/CommunityToolkit.Aspire.Java.Hosting.EndToEndTests/{ProgramTests.cs => JavaHostingComponentTests.cs} (79%) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d72631b9..ecf35875 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -63,7 +63,7 @@ jobs: - name: Build run: dotnet build --no-restore --configuration ${{ env.DOTNET_CONFIGURATION }} - name: Test - run: dotnet test --no-build --configuration ${{ env.DOTNET_CONFIGURATION }} --collect "XPlat Code Coverage" --results-directory test-results --logger trx -parallel none + run: dotnet test --no-build --configuration ${{ env.DOTNET_CONFIGURATION }} --collect "XPlat Code Coverage" --results-directory test-results --logger trx - name: Upload test results uses: actions/upload-artifact@v4 diff --git a/tests/CommunityToolkit.Aspire.Hosting.Azure.StaticWebApps.Tests/AssemblyInfo.cs b/tests/CommunityToolkit.Aspire.Hosting.Azure.StaticWebApps.Tests/AssemblyInfo.cs new file mode 100644 index 00000000..b0b47aa7 --- /dev/null +++ b/tests/CommunityToolkit.Aspire.Hosting.Azure.StaticWebApps.Tests/AssemblyInfo.cs @@ -0,0 +1 @@ +[assembly: CollectionBehavior(DisableTestParallelization = true)] \ No newline at end of file diff --git a/tests/CommunityToolkit.Aspire.Hosting.Azure.StaticWebApps.Tests/SwaHostingComponentTests.cs b/tests/CommunityToolkit.Aspire.Hosting.Azure.StaticWebApps.Tests/SwaHostingComponentTests.cs index 6bdff992..f4d347c2 100644 --- a/tests/CommunityToolkit.Aspire.Hosting.Azure.StaticWebApps.Tests/SwaHostingComponentTests.cs +++ b/tests/CommunityToolkit.Aspire.Hosting.Azure.StaticWebApps.Tests/SwaHostingComponentTests.cs @@ -6,6 +6,7 @@ namespace CommunityToolkit.Aspire.Hosting.Azure.StaticWebApps.Tests; +[Collection("Integration Tests")] public class SwaHostingComponentTests(ITestOutputHelper testOutput) : AspireIntegrationTest(testOutput) { [Fact] @@ -15,6 +16,7 @@ public async Task EmulatorLaunchesOnDefaultPort() await ResourceNotificationService.WaitForResourceAsync("swa", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30)); await ResourceNotificationService.WaitForResourceAsync("web", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30)); + await ResourceNotificationService.WaitForResourceAsync("api", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30)); var response = await httpClient.GetAsync("/"); diff --git a/tests/CommunityToolkit.Aspire.Java.Hosting.EndToEndTests/AssemblyInfo.cs b/tests/CommunityToolkit.Aspire.Java.Hosting.EndToEndTests/AssemblyInfo.cs new file mode 100644 index 00000000..b0b47aa7 --- /dev/null +++ b/tests/CommunityToolkit.Aspire.Java.Hosting.EndToEndTests/AssemblyInfo.cs @@ -0,0 +1 @@ +[assembly: CollectionBehavior(DisableTestParallelization = true)] \ No newline at end of file diff --git a/tests/CommunityToolkit.Aspire.Java.Hosting.EndToEndTests/ProgramTests.cs b/tests/CommunityToolkit.Aspire.Java.Hosting.EndToEndTests/JavaHostingComponentTests.cs similarity index 79% rename from tests/CommunityToolkit.Aspire.Java.Hosting.EndToEndTests/ProgramTests.cs rename to tests/CommunityToolkit.Aspire.Java.Hosting.EndToEndTests/JavaHostingComponentTests.cs index b92fb6eb..0ef0d505 100644 --- a/tests/CommunityToolkit.Aspire.Java.Hosting.EndToEndTests/ProgramTests.cs +++ b/tests/CommunityToolkit.Aspire.Java.Hosting.EndToEndTests/JavaHostingComponentTests.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Aspire.Java.Hosting.EndToEndTests; -public class ProgramTests(ITestOutputHelper testOutput) : AspireIntegrationTest(testOutput) +[Collection("Integration Tests")] +public class JavaHostingComponentTests(ITestOutputHelper testOutput) : AspireIntegrationTest(testOutput) { [Fact] public async Task Given_Container_Resource_When_Invoked_Then_Root_Returns_OK() @@ -22,7 +23,7 @@ public async Task Given_Container_Resource_When_Invoked_Then_Root_Returns_OK() [Fact] public async Task Given_Executable_Resource_When_Invoked_Then_Root_Returns_OK() { - var httpClient = app.CreateHttpClient("containerapp"); + var httpClient = app.CreateHttpClient("executableapp"); await ResourceNotificationService.WaitForResourceAsync("executableapp", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30));