Closed MladenMircic closed 3 weeks ago
Phew, it has been a while since I configured GitLab CI/CD with Testcontainers. IIRC it is not necessary to set the TESTCONTAINERS_HOST_OVERRIDE
environment variable. Can you please remove all the environment variable configurations and follow this and/or this approach (without the Java-specific steps) to configure the DinD service? If you still run into issues, please follow up with the error.
It was a problem connecting Hangfire library to the test environment. It is now fixed, thank you :)
Ok, this looks much better. In the logs, you can see that Testcontainers can pull, run, and access Ryuk, and at least pull and run MSSQL.
According to the logs, it appears that you have overwritten the default wait strategy. Please do not. Your chosen wait strategy may indicate readiness too early (the network port is available before the actual service in the container is running). Please use the default builder configuration.
IIRC it is necessary to remove more DI registered services. Please refer to this guide for further details.
These days, I prefer to provide the connection string via the application settings and not mess around with the DI registered services (see Set Redis connection string).
Testcontainers version
3.8.0
Using the latest Testcontainers version?
Yes
Host OS
Linux
Host arch
amd64
.NET version
7.0.410
Docker version
Docker info
What happened?
Expected behavior Running dotnet xUnit integration tests are working correctly when run on local machine using MSSQL testcontainer. Same is expected when running them on Gitlab CI/CD using DinD service.
Actual behavior Tests are failing because Ryuk initialization has stopped.
I have seen multiple issues reported on the same topic and I have tried almost all of the suggested solutions which include setting
TESTCONTAINERS_HOST_OVERRIDE: "host.docker.internal"
andTESTCONTAINERS_HOST_OVERRIDE: "localhost"
and disabling Ryuk altogether.Exception when I set
TESTCONTAINERS_HOST_OVERRIDE: "host.docker.internal"
:Exception when I set
TESTCONTAINERS_HOST_OVERRIDE: "localhost"
:And then every test throws the same exception:
Exception when I disable Ryuk:
Relevant log output
No response
Additional information
Container initialization factory
I have also tried binding to port 1433 for MSSQL
I am absolutely sure that I have misconfigured something, but I can't quite figure it out. Any help would be highly appreciated!