Test Postgres database definition

This commit is contained in:
Boris Milašinović
2026-04-29 16:36:13 +02:00
parent b849c6feb6
commit 8f7c704a90
13 changed files with 2340 additions and 10 deletions

View File

@@ -56,11 +56,7 @@ internal sealed class UiTestHarness : IAsyncDisposable
CreateNoWindow = true
};
startInfo.Environment["ASPNETCORE_ENVIRONMENT"] = "UITest";
#if POSTGRES
startInfo.Environment["ConnectionStrings__EventsPostgres"] = ResolveUiTestConnectionString();
#else
startInfo.Environment["ConnectionStrings__EventsMssql"] = ResolveUiTestConnectionString();
#endif
var appProcess = Process.Start(startInfo)
?? throw new InvalidOperationException("Failed to start the MVC app process for UI tests.");
@@ -171,11 +167,11 @@ internal sealed class UiTestHarness : IAsyncDisposable
.AddUserSecrets<Program>(optional: true)
.Build();
var connectionString = configuration.GetConnectionString("EventDB-Test");
var connectionString = configuration.GetConnectionString("EventsPostgres-Test");
if (string.IsNullOrWhiteSpace(connectionString))
{
throw new InvalidOperationException(
"The EventDB-Test connection string must be available so UI tests can connect to the selected provider's test database.");
"The EventsPostgres-Test connection string must be available so UI tests can connect to the PostgreSQL test database on port 5433.");
}
return connectionString;