fix: corriger les issues mineures du review
🟡 SnapshotUrl: validation sécurité SSRF (scheme + loopback) 🟡 Integration tests: skip graceful sans PostgreSQL (TestContainers)
This commit is contained in:
1 parent
fba29b3eb4
commit
a6b2a21ebc
3 files changed
+54
-2
No files matched your search
@@ -11,15 +11,18 @@ namespace Heimdall.IntegrationTests.Controllers;
|
||||
/// via Testcontainers. All test classes in the "Postgres" collection share
|
||||
/// the same PostgreSQL database.
|
||||
/// Resets the database before each test to guarantee isolation.
|
||||
/// If Docker/PostgreSQL is unavailable, all tests skip gracefully instead of failing.
|
||||
/// </summary>
|
||||
[Collection("Postgres")]
|
||||
public abstract class PostgresTestBase : IAsyncLifetime
|
||||
{
|
||||
private readonly PostgreSqlContainerFixture _postgres;
|
||||
private readonly Lazy<HeimdallWebApplicationFactory> _factoryLazy;
|
||||
private readonly string _connectionString;
|
||||
|
||||
protected PostgresTestBase(PostgreSqlContainerFixture postgres)
|
||||
{
|
||||
_postgres = postgres;
|
||||
_connectionString = postgres.ConnectionString;
|
||||
_factoryLazy = new Lazy<HeimdallWebApplicationFactory>(
|
||||
() => new HeimdallWebApplicationFactory(postgres.ConnectionString));
|
||||
@@ -30,6 +33,9 @@ public abstract class PostgresTestBase : IAsyncLifetime
|
||||
|
||||
public virtual async Task InitializeAsync()
|
||||
{
|
||||
if (!_postgres.IsAvailable)
|
||||
return;
|
||||
|
||||
await ResetDatabaseAsync();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user