fix: share one PostgreSQL Testcontainer across all test projects
Create Heimdall.TestCommon project with a single PostgreSqlContainerFixture shared by both Infrastructure and Integration tests. This prevents Docker resource conflicts from starting two PostgreSQL containers and ensures both test suites connect to the same database instance. - Move shared fixture to tests/Heimdall.TestCommon - Remove duplicate fixtures from each test project - Keep test isolation (truncation) and FK fix from previous commit - Revert DATABASE_URL env var check (Testcontainers works in CI)
This commit is contained in:
1 parent
53e0d4c199
commit
b167c2afcf
12 files changed
+83
-122
No files matched your search
@@ -1,6 +1,7 @@
|
||||
using Heimdall.Infrastructure.Data;
|
||||
using Heimdall.Infrastructure.Data.Interceptors;
|
||||
using Heimdall.IntegrationTests.Factories;
|
||||
using Heimdall.TestCommon;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Heimdall.IntegrationTests.Controllers;
|
||||
@@ -8,7 +9,7 @@ namespace Heimdall.IntegrationTests.Controllers;
|
||||
/// <summary>
|
||||
/// Base class for integration tests that need a real PostgreSQL database
|
||||
/// via Testcontainers. All test classes in the "Postgres" collection share
|
||||
/// the same PostgreSQL container.
|
||||
/// the same PostgreSQL database.
|
||||
/// Resets the database before each test to guarantee isolation.
|
||||
/// </summary>
|
||||
[Collection("Postgres")]
|
||||
|
||||
Reference in new issue
Block a user