Initial curated itworx-knowledge-hub source from 3b1751d0d9dee551aa6994eee0093704dc334817

This commit is contained in:
Public Source Publisher committed 2026-10-01 01:37:37 +02:00
commit ad8ad252a9
825 files changed
+124216

No files matched your search

@@ -0,0 +1,29 @@
using System.Net;
using ItWorx.KnowledgeHub.IntegrationTests.Infrastructure;
namespace ItWorx.KnowledgeHub.IntegrationTests.Auth;
/// <summary>Regression coverage for a real bug found via E2E testing: two concurrent
/// logins for the same account raced on ASP.NET Core Identity's optimistic-concurrency
/// token while recording the last-login timestamp, turning a successful authentication
/// into a 500 for whichever request lost the race.</summary>
[Collection(PostgresTestGroup.Name)]
public sealed class ConcurrentLoginTests(PostgresContainerFixture postgres) : OwnerSetupTestBase(postgres)
{
[Fact]
public async Task Concurrent_logins_for_the_same_account_never_fail_with_a_server_error()
{
using var clientA = Factory.CreateClient();
using var clientB = Factory.CreateClient();
var loginA = SetupHelper.LoginAsync(clientA, OwnerEmail, OwnerPassword);
var loginB = SetupHelper.LoginAsync(clientB, OwnerEmail, OwnerPassword);
var results = await Task.WhenAll(loginA, loginB);
foreach (var response in results)
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
}
}