Implemented test containers host override.
All checks were successful
ci / build-test (push) Successful in 1m27s

This commit is contained in:
2025-11-02 15:21:54 -05:00
parent 1160920764
commit 678e8d4fc4
2 changed files with 7 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ jobs:
env:
TESTCONTAINERS_RYUK_DISABLED: 'true'
TESTCONTAINERS_CHECKS_DISABLE: 'true'
TESTCONTAINERS_HOST_OVERRIDE: host.docker.internal
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4

View File

@@ -30,7 +30,12 @@ public sealed class MariaDbContainerFixture : IAsyncLifetime
await _container.StartAsync();
RootConnectionString = _container.GetConnectionString();
var hostOverride = Environment.GetEnvironmentVariable("TESTCONTAINERS_HOST_OVERRIDE");
var host = string.IsNullOrWhiteSpace(hostOverride) ? "127.0.0.1" : hostOverride;
RootConnectionString = _container.GetConnectionString()
.Replace("127.0.0.1", host) // normalize when running inside job container
.Replace("localhost", host);
// Build the template ONCE with EF + your existing seed
await MariaDbClone.CreateTemplateAsync(