Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Restructure tests into their own shards to speed up parallel execution (#233)
Leendert de Borstd471a61fbf15
diff --git a/.github/workflows/dotnet-e2e-client-tests.yml b/.github/workflows/dotnet-e2e-client-tests.ymlindex 13b0d8ac7..c2a34e7e2 100644--- a/.github/workflows/dotnet-e2e-client-tests.yml+++ b/.github/workflows/dotnet-e2e-client-tests.yml@@ -1,4 +1,4 @@-name: .NET E2E Client Tests (Playwright)+name: .NET E2E Client Tests (Playwright with Sharding)on:push:@@ -10,6 +10,10 @@ jobs:client-tests:timeout-minutes: 60runs-on: ubuntu-latest+ strategy:+ fail-fast: false+ matrix:+ shard: [1, 2, 3, 4, 5]steps:- uses: actions/checkout@v4@@ -27,16 +31,32 @@ jobs:- name: Ensure browsers are installedrun: pwsh src/Tests/AliasVault.E2ETests/bin/Debug/net8.0/playwright.ps1 install --with-deps- - name: Run ClientTests with retry+ - name: Run ClientTests with retry (Shard ${{ matrix.shard }})uses: nick-fields/retry@v3with:timeout_minutes: 60max_attempts: 3- command: dotnet test src/Tests/AliasVault.E2ETests --no-build --verbosity normal --filter "Category=ClientTests"+ command: dotnet test src/Tests/AliasVault.E2ETests --no-build --verbosity normal --filter "FullyQualifiedName~.ClientTests.Shard${{ matrix.shard }}."- name: Upload Test Resultsif: always()uses: actions/upload-artifact@v3with:- name: client-test-results- path: TestResults-Client.xml+ name: client-test-results-shard-${{ matrix.shard }}+ path: TestResults-Client-Shard-${{ matrix.shard }}.xml++ publish-test-results:+ name: "Publish Test Results"+ needs: client-tests+ runs-on: ubuntu-latest+ if: always()+ steps:+ - name: Download Artifacts+ uses: actions/download-artifact@v3+ with:+ path: artifacts++ - name: Publish Test Results+ uses: EnricoMi/publish-unit-test-result-action@v2+ with:+ nunit_files: "artifacts/**/*.xml"diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/README.md b/src/Tests/AliasVault.E2ETests/Tests/Client/README.mdnew file mode 100644index 000000000..3c509f7ca--- /dev/null+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/README.md@@ -0,0 +1,25 @@+# Client Tests+This folder contains tests separated in their own "Shard" folder.++During CI/CD pipeline, each shard (and all tests assigned to it) executed in a separate VM.+This is done to speed up the execution of the tests.++When adding new tests, you can add them to an existing shard or create a new shard.++## Creating a new shard+To create a new shard, follow these steps:++1. Create a new folder in the `Tests` folder with the name of the shard. E.g. `Shard5`.+2. Change GitHub Actions workflow file for client tests:+ 1. Open the file `.github/workflows/dotnet-e2e-client-tests.yml`.+ 2. Find the `strategy` section. Add a new shard to the `matrix` section. E.g. when adding shard 5 update the line to the following:+ ```+ matrix:+ shard: [1, 2, 3, 4, 5]+ ```+3. The GitHub actions looks at the namespace of each test to know in what shard they should be executed in. Since the+ tests are placed in a folder with the shard name, the namespace should already be correct. However if there+ are any issues, verify that the namespace of the test is correct. E.g. for shard 5 the namespace of the test class should be:+```+namespace AliasVault.E2ETests.Tests.Client.Shard5;+```diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/ApiLoggingTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/ApiLoggingTests.cssimilarity index 97%rename from src/Tests/AliasVault.E2ETests/Tests/Client/ApiLoggingTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/ApiLoggingTests.csindex cc312b0f7..d33995180 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/ApiLoggingTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/ApiLoggingTests.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard1;using Microsoft.EntityFrameworkCore;diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/CredentialTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cssimilarity index 99%rename from src/Tests/AliasVault.E2ETests/Tests/Client/CredentialTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.csindex f97f5c34f..0c16a2122 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/CredentialTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/CredentialTests.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard1;/// <summary>/// End-to-end tests for the credential management.diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/EmailDecryptionTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/EmailDecryptionTests.cssimilarity index 99%rename from src/Tests/AliasVault.E2ETests/Tests/Client/EmailDecryptionTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/EmailDecryptionTests.csindex 61f982c8b..bcc83b981 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/EmailDecryptionTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/EmailDecryptionTests.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard1;using AliasVault.IntegrationTests.SmtpServer;using MailKit.Net.Smtp;diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/GeneralSettingsTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/GeneralSettingsTests.cssimilarity index 97%rename from src/Tests/AliasVault.E2ETests/Tests/Client/GeneralSettingsTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/GeneralSettingsTests.csindex 832f736c9..9e1535715 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/GeneralSettingsTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/GeneralSettingsTests.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard1;/// <summary>/// End-to-end tests for general settings.diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/JwtTokenTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/JwtTokenTests.cssimilarity index 98%rename from src/Tests/AliasVault.E2ETests/Tests/Client/JwtTokenTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/JwtTokenTests.csindex c34ca205c..381205530 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/JwtTokenTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/JwtTokenTests.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard1;/// <summary>/// End-to-end tests for JWT token handling.diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/SearchTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/SearchTests.cssimilarity index 97%rename from src/Tests/AliasVault.E2ETests/Tests/Client/SearchTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/SearchTests.csindex 2fa22c4d3..b96418e36 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/SearchTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/SearchTests.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard1;/// <summary>/// End-to-end tests for searching.diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/DbCleanupTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbCleanupTests.cssimilarity index 97%rename from src/Tests/AliasVault.E2ETests/Tests/Client/DbCleanupTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbCleanupTests.csindex 81462cab0..53e9c0689 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/DbCleanupTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbCleanupTests.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard2;/// <summary>/// End-to-end tests for the client database persistence.diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/DbPersistTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbPersistTests.cssimilarity index 98%rename from src/Tests/AliasVault.E2ETests/Tests/Client/DbPersistTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbPersistTests.csindex 92b320697..5e8824f75 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/DbPersistTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbPersistTests.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard2;using Microsoft.EntityFrameworkCore;diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/DbSyncTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cssimilarity index 99%rename from src/Tests/AliasVault.E2ETests/Tests/Client/DbSyncTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.csindex f3dd1568d..b0bd1015e 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/DbSyncTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbSyncTests.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard2;using Microsoft.EntityFrameworkCore;diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/DbUpgradeTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbUpgradeTests.cssimilarity index 98%rename from src/Tests/AliasVault.E2ETests/Tests/Client/DbUpgradeTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbUpgradeTests.csindex daf194ba8..bf3920b1d 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/DbUpgradeTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard2/DbUpgradeTests.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard2;using AliasServerDb;diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/Abstracts/TwoFactorAuthBase.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/Abstracts/TwoFactorAuthBase.cssimilarity index 98%rename from src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/Abstracts/TwoFactorAuthBase.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/Abstracts/TwoFactorAuthBase.csindex eb5abed41..6852b90b9 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/Abstracts/TwoFactorAuthBase.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/Abstracts/TwoFactorAuthBase.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client.TwoFactorAuth.Abstracts;+namespace AliasVault.E2ETests.Tests.Client.Shard3.Abstracts;/// <summary>/// Abstract base class for two factor auth test which contains common methods.diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/CodeLockoutTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/CodeLockoutTests.cssimilarity index 95%rename from src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/CodeLockoutTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/CodeLockoutTests.csindex 6cf583962..ffd3a6dbc 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/CodeLockoutTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/CodeLockoutTests.cs@@ -5,9 +5,9 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client.TwoFactorAuth;+namespace AliasVault.E2ETests.Tests.Client.Shard3;-using AliasVault.E2ETests.Tests.Client.TwoFactorAuth.Abstracts;+using AliasVault.E2ETests.Tests.Client.Shard3.Abstracts;/// <summary>/// End-to-end tests for user two-factor authentication code lockout behavior.diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/RecoveryLockoutTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/RecoveryLockoutTests.cssimilarity index 95%rename from src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/RecoveryLockoutTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/RecoveryLockoutTests.csindex 4f91a4270..3e16197ad 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/RecoveryLockoutTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/RecoveryLockoutTests.cs@@ -5,9 +5,9 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client.TwoFactorAuth;+namespace AliasVault.E2ETests.Tests.Client.Shard3;-using AliasVault.E2ETests.Tests.Client.TwoFactorAuth.Abstracts;+using AliasVault.E2ETests.Tests.Client.Shard3.Abstracts;/// <summary>/// End-to-end tests for user two-factor authentication recovery code lockout behavior.diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/TwoFactorAuthTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/TwoFactorAuthTests.cssimilarity index 97%rename from src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/TwoFactorAuthTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/TwoFactorAuthTests.csindex 876a4b941..4a49727ba 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/TwoFactorAuth/TwoFactorAuthTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard3/TwoFactorAuthTests.cs@@ -5,9 +5,9 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client.TwoFactorAuth;+namespace AliasVault.E2ETests.Tests.Client.Shard3;-using AliasVault.E2ETests.Tests.Client.TwoFactorAuth.Abstracts;+using AliasVault.E2ETests.Tests.Client.Shard3.Abstracts;/// <summary>/// End-to-end tests for user two-factor authentication.diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/AuthTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard4/AuthTests.cssimilarity index 99%rename from src/Tests/AliasVault.E2ETests/Tests/Client/AuthTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard4/AuthTests.csindex 321ddb85e..d815acc42 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/AuthTests.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard4/AuthTests.cs@@ -5,7 +5,7 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard4;using AliasVault.Shared.Models.Enums;using Microsoft.EntityFrameworkCore;@@ -15,6 +15,7 @@ using Microsoft.EntityFrameworkCore;/// </summary>[Parallelizable(ParallelScope.Self)][Category("ClientTests")]+[TestFixture]public class AuthTests : ClientPlaywrightTest{diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/AuthPasswordChangeTest.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AuthPasswordChangeTest.cssimilarity index 98%rename from src/Tests/AliasVault.E2ETests/Tests/Client/AuthPasswordChangeTest.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AuthPasswordChangeTest.csindex e78d22a44..be2e207c0 100644--- a/src/Tests/AliasVault.E2ETests/Tests/Client/AuthPasswordChangeTest.cs+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/AuthPasswordChangeTest.cs@@ -5,13 +5,14 @@// </copyright>//------------------------------------------------------------------------namespace AliasVault.E2ETests.Tests.Client;+namespace AliasVault.E2ETests.Tests.Client.Shard5;/// <summary>/// End-to-end tests for authentication./// </summary>[Parallelizable(ParallelScope.Self)][Category("ClientTests")]+[TestFixture]public class AuthPasswordChangeTest : ClientPlaywrightTest{diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/UnlockTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/UnlockTests.cssimilarity index 100%rename from src/Tests/AliasVault.E2ETests/Tests/Client/UnlockTests.csrename to src/Tests/AliasVault.E2ETests/Tests/Client/Shard5/UnlockTests.cs