Implemented test containers host override.
All checks were successful
ci / build-test (push) Successful in 1m27s
All checks were successful
ci / build-test (push) Successful in 1m27s
This commit is contained in:
@@ -14,6 +14,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
TESTCONTAINERS_RYUK_DISABLED: 'true'
|
TESTCONTAINERS_RYUK_DISABLED: 'true'
|
||||||
TESTCONTAINERS_CHECKS_DISABLE: 'true'
|
TESTCONTAINERS_CHECKS_DISABLE: 'true'
|
||||||
|
TESTCONTAINERS_HOST_OVERRIDE: host.docker.internal
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-dotnet@v4
|
- uses: actions/setup-dotnet@v4
|
||||||
|
|||||||
@@ -30,7 +30,12 @@ public sealed class MariaDbContainerFixture : IAsyncLifetime
|
|||||||
|
|
||||||
await _container.StartAsync();
|
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
|
// Build the template ONCE with EF + your existing seed
|
||||||
await MariaDbClone.CreateTemplateAsync(
|
await MariaDbClone.CreateTemplateAsync(
|
||||||
|
|||||||
Reference in New Issue
Block a user