From c046967920e388136d3426c2d59471b61ba694b1 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Wed, 6 Nov 2024 22:04:44 +0200 Subject: [PATCH 1/5] Updates GitHub Actions to disable parallel tests run --- .github/workflows/run-tests.yml | 6 +++++- .../Lumina.DataAccess.IntegrationTests.csproj | 9 ++++++++- .../Lumina.Presentation.Api.IntegrationTests.csproj | 9 ++++++++- .../Lumina.Application.UnitTests.csproj | 7 +++++++ .../Lumina.DataAccess.UnitTests.csproj | 7 +++++++ .../Lumina.Domain.UnitTests.csproj | 7 +++++++ .../Lumina.Infrastructure.UnitTests.csproj | 7 +++++++ .../Lumina.Presentation.Api.UnitTests.csproj | 7 +++++++ 8 files changed, 56 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 58995ba6..c303c406 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -6,6 +6,10 @@ on: - master workflow_dispatch: # enable manual triggers +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: test: runs-on: ubuntu-latest @@ -24,4 +28,4 @@ jobs: - name: Build run: dotnet build src/Lumina.sln --no-restore - name: Run tests - run: dotnet test src/Lumina.sln --no-build --verbosity normal \ No newline at end of file + run: dotnet test src/Lumina.sln --no-build --verbosity detailed \ No newline at end of file diff --git a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Lumina.DataAccess.IntegrationTests.csproj b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Lumina.DataAccess.IntegrationTests.csproj index 99d79575..e10b2ec4 100644 --- a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Lumina.DataAccess.IntegrationTests.csproj +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Lumina.DataAccess.IntegrationTests.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -9,6 +9,13 @@ true + + + <_Parameter1>DisableTestParallelization = true + <_Parameter1_IsLiteral>true + + + diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Lumina.Presentation.Api.IntegrationTests.csproj b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Lumina.Presentation.Api.IntegrationTests.csproj index cd3185ae..eaeffc53 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Lumina.Presentation.Api.IntegrationTests.csproj +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Lumina.Presentation.Api.IntegrationTests.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -9,6 +9,13 @@ true + + + <_Parameter1>DisableTestParallelization = true + <_Parameter1_IsLiteral>true + + + diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Lumina.Application.UnitTests.csproj b/tests/UnitTests/Lumina.Application.UnitTests/Lumina.Application.UnitTests.csproj index be3baccd..2c010ff3 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Lumina.Application.UnitTests.csproj +++ b/tests/UnitTests/Lumina.Application.UnitTests/Lumina.Application.UnitTests.csproj @@ -9,6 +9,13 @@ true + + + <_Parameter1>DisableTestParallelization = true + <_Parameter1_IsLiteral>true + + + diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Lumina.DataAccess.UnitTests.csproj b/tests/UnitTests/Lumina.DataAccess.UnitTests/Lumina.DataAccess.UnitTests.csproj index 9df609a8..0e5c2ccc 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Lumina.DataAccess.UnitTests.csproj +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Lumina.DataAccess.UnitTests.csproj @@ -9,6 +9,13 @@ true + + + <_Parameter1>DisableTestParallelization = true + <_Parameter1_IsLiteral>true + + + diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Lumina.Domain.UnitTests.csproj b/tests/UnitTests/Lumina.Domain.UnitTests/Lumina.Domain.UnitTests.csproj index 5d139de7..0e0a37a6 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Lumina.Domain.UnitTests.csproj +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Lumina.Domain.UnitTests.csproj @@ -9,6 +9,13 @@ true + + + <_Parameter1>DisableTestParallelization = true + <_Parameter1_IsLiteral>true + + + diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Lumina.Infrastructure.UnitTests.csproj b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Lumina.Infrastructure.UnitTests.csproj index a7903a6d..383c405d 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Lumina.Infrastructure.UnitTests.csproj +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Lumina.Infrastructure.UnitTests.csproj @@ -9,6 +9,13 @@ true + + + <_Parameter1>DisableTestParallelization = true + <_Parameter1_IsLiteral>true + + + diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Lumina.Presentation.Api.UnitTests.csproj b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Lumina.Presentation.Api.UnitTests.csproj index 00f5fcd4..da6851bf 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Lumina.Presentation.Api.UnitTests.csproj +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Lumina.Presentation.Api.UnitTests.csproj @@ -9,6 +9,13 @@ true + + + <_Parameter1>DisableTestParallelization = true + <_Parameter1_IsLiteral>true + + + From 1a2aa36126c90cc7f225d239e145582e1d20dca0 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Wed, 6 Nov 2024 22:07:58 +0200 Subject: [PATCH 2/5] Updates GitHub Actions to disable parallel tests run --- .github/workflows/run-tests.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index c303c406..fcc5ba31 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -12,11 +12,12 @@ concurrency: jobs: test: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + max-parallel: 1 environment: test - env: # Set Environment options that are meant to be left empty so the user fills them - JwtSettings__SecretKey: ${{ secrets.JWT_SETTINGS_SECRET_KEY }} - EncryptionSettings__SecretKey: ${{ secrets.ENCRYPTION_SETTINGS_SECRET_KEY }} steps: - uses: actions/checkout@v2 - name: Set up .NET From 5e25474831d2ce51591950ecae6eaa7419fa9a07 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Wed, 6 Nov 2024 22:30:52 +0200 Subject: [PATCH 3/5] Changes to use database migrations during integration tests --- .../Common/Setup/LuminaApiFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/LuminaApiFactory.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/LuminaApiFactory.cs index 434c29c2..5c02727c 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/LuminaApiFactory.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/LuminaApiFactory.cs @@ -67,7 +67,7 @@ public class LuminaApiFactory : WebApplicationFactory, IDisposable { IServiceProvider scopedServices = scope.ServiceProvider; LuminaDbContext dbContext = scopedServices.GetRequiredService(); - dbContext.Database.EnsureCreated(); + dbContext.Database.Migrate(); } }); } From c35471d60044f096e3d137cc38f1089367dcf3ba Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Thu, 7 Nov 2024 09:28:21 +0200 Subject: [PATCH 4/5] Fixes flaky unit test for nexted directories --- .../Directories/GetDirectoryTreeEndpointTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectoryTreeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectoryTreeEndpointTests.cs index af90615e..cd0c8f84 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectoryTreeEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectoryTreeEndpointTests.cs @@ -106,7 +106,7 @@ public class GetDirectoryTreeEndpointTests : IClassFixture } } } - FileSystemTreeNodeResponse rootNode = treeNodes!.First(); + FileSystemTreeNodeResponse rootNode = treeNodes!.Where(node => testPath.StartsWith(node.Name)).First(); ValidateNode(rootNode, 0); } finally @@ -178,7 +178,7 @@ public class GetDirectoryTreeEndpointTests : IClassFixture } } } - FileSystemTreeNodeResponse rootNode = treeNodes!.First(); + FileSystemTreeNodeResponse rootNode = treeNodes!.Where(node => testPath.StartsWith(node.Name)).First(); ValidateNode(rootNode, 0); } finally @@ -241,7 +241,7 @@ public class GetDirectoryTreeEndpointTests : IClassFixture foreach (FileSystemTreeNodeResponse childNode in node.Children) ValidateNode(childNode, depth + 1); } - FileSystemTreeNodeResponse rootNode = treeNodes!.First(); + FileSystemTreeNodeResponse rootNode = treeNodes!.Where(node => testPath.StartsWith(node.Name)).First(); ValidateNode(rootNode, 0); } finally @@ -304,7 +304,7 @@ public class GetDirectoryTreeEndpointTests : IClassFixture foreach (FileSystemTreeNodeResponse childNode in node.Children) ValidateNode(childNode, depth + 1); } - FileSystemTreeNodeResponse rootNode = treeNodes!.First(); + FileSystemTreeNodeResponse rootNode = treeNodes!.Where(node => testPath.StartsWith(node.Name)).First(); ValidateNode(rootNode, 0); } finally From a34ba949a7851b22b590ebce8c207c8679598664 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Thu, 7 Nov 2024 09:49:59 +0200 Subject: [PATCH 5/5] Reverts GitHub Action script change --- .github/workflows/run-tests.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index fcc5ba31..96210805 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -6,17 +6,9 @@ on: - master workflow_dispatch: # enable manual triggers -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - jobs: test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - max-parallel: 1 + runs-on: ubuntu-latest environment: test steps: - uses: actions/checkout@v2 @@ -29,4 +21,4 @@ jobs: - name: Build run: dotnet build src/Lumina.sln --no-restore - name: Run tests - run: dotnet test src/Lumina.sln --no-build --verbosity detailed \ No newline at end of file + run: dotnet test src/Lumina.sln --no-build --verbosity normal \ No newline at end of file