orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Migrates Consul tests to use Testcontainers

Open Meir017 opened this issue 2 months ago • 3 comments

just saw #9701 and realized we can further simplify the tests by using testcontainers

Replaces manual Docker container management in CI workflows with Testcontainers library for better test isolation and reliability.

Removes hardcoded Consul setup from GitHub Actions workflow and updates test utilities to programmatically manage container lifecycle.

Updates Testcontainers dependency to latest version for improved compatibility.

no setup on my machine, tests just work - image

Microsoft Reviewers: Open in CodeFlow

Meir017 avatar Oct 05 '25 20:10 Meir017

@ReubenBond I think the two github-actions that failed are unstable, all actions passed

Meir017 avatar Oct 26 '25 17:10 Meir017

@Meir017 they look like Consul failures, based on the output:

Error: System.TypeInitializationException : The type initializer for 'Consul.Tests.ConsulTestUtils' threw an exception.
---- DotNet.Testcontainers.Builders.DockerUnavailableException : Docker is either not running or misconfigured. Please ensure that Docker is running and that the endpoint is properly configured.
You can customize your configuration using either the environment variables or the ~/.testcontainers.properties file.
For more information, visit: [https://dotnet.testcontainers.org/custom_configuration/.](https://dotnet.testcontainers.org/custom_configuration/)
  Details: 
    Failed to connect to Docker endpoint at 'unix:///var/run/docker.sock'.
    Failed to connect to Docker endpoint at 'unix:///var/run/docker.sock'.
-------- System.AggregateException : One or more errors occurred. (Failed to connect to Docker endpoint at 'unix:///var/run/docker.sock'.) (Failed to connect to Docker endpoint at 'unix:///var/run/docker.sock'.)
------------ DotNet.Testcontainers.Builders.DockerUnavailableException : Failed to connect to Docker endpoint at 'unix:///var/run/docker.sock'.
---------------- System.Net.Http.HttpRequestException : Connection failed.
-------------------- System.Net.Sockets.SocketException : Can't assign requested address
------------ DotNet.Testcontainers.Builders.DockerUnavailableException : Failed to connect to Docker endpoint at 'unix:///var/run/docker.sock'.
---------------- System.Net.Http.HttpRequestException : Connection failed.
--------  Skipped ------------ System.Net.Sockets.SocketException : Can't assign requested address

ReubenBond avatar Oct 26 '25 18:10 ReubenBond

hmm, wer'e getting the error

Error: System.AggregateException : One or more errors occurred. (Docker API responded with status code=BadRequest, response={"message":"invalid CapAdd: unknown capability: \"CAP_IPC_LOCK\""}

seems to be related to this https://github.com/testcontainers/testcontainers-dotnet/blob/4a72cb31f51206eb9f5d710fc6621650fdab89ee/src/Testcontainers.Consul/ConsulBuilder.cs#L50C27-L50C28

I'll check this out

Meir017 avatar Oct 26 '25 20:10 Meir017