CI/CD Test Container intermittently not starting up or rather being stopping with no clear indication why #1115
-
I've setup set up Testcontainers.Net to spin up a continar running the Cosmos Emulator and use this to run my integration tests (xUnit) against. This has been great and works very consistently when running on my desktop in Visual Studio. I have since included these tests as part of a CI/CD pipeline and the tests are failing intermittently (roughly 50% of the time I'd say). The failed runs seem to happen quickly e.g. within 3-5 seconds of the container starting, I see a Feels like there is a screw loose but I'm not sure where, please help. Logs on a failed run.
Logs on a successful run.
Container configuration _dbContainer = new CosmosDbBuilder()
.WithImage("mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator")
.WithName("azure-cosmos-emulator")
.WithExposedPort(8081)
.WithExposedPort(10251)
.WithExposedPort(10252)
.WithExposedPort(10253)
.WithExposedPort(10254)
.WithPortBinding(8081, true)
.WithPortBinding(10251, true)
.WithPortBinding(10252, true)
.WithPortBinding(10253, true)
.WithPortBinding(10254, true)
.WithEnvironment("AZURE_COSMOS_EMULATOR_PARTITION_COUNT", "1")
.WithEnvironment("AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE", "127.0.0.1")
.WithEnvironment("AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE", "false")
.WithWaitStrategy(Wait.ForUnixContainer()
.UntilPortIsAvailable(8081))
.Build(); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I assume you are using MS-hosted agents/runners (Azure DevOps or GitHub). Unfortunately, this is a known issue. The image does not run properly on those agents (VMs). Here (Azure/azure-cosmos-db-emulator-docker#45.) is the upstream issue. Perhaps you can share your experience too, and Microsoft finally decides to fix it 😄. That is the reason why our Cosmos DB emulator tests are disabled: BTW: Usually, there is no reason to override the module's default configuration. I would like to emphasize that the wait strategy does not look right. We recently changed it in the module as well because it indicated readiness too early, and SSL was not ready at that point. |
Beta Was this translation helpful? Give feedback.
I assume you are using MS-hosted agents/runners (Azure DevOps or GitHub). Unfortunately, this is a known issue. The image does not run properly on those agents (VMs). Here (Azure/azure-cosmos-db-emulator-docker#45.) is the upstream issue. Perhaps you can share your experience too, and Microsoft finally decides to fix it 😄. That is the reason why our Cosmos DB emulator tests are disabled:
testcontainers-dotnet/tests/Testcontainers.CosmosDb.Tests/CosmosDbContainerTest.cs
Line 17 in f9afd0c