Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

TestContainer in DotNet Core31 pipeline

Edited

Hello,

I have read a previous issue raised https://github.com/HofmeisterAn/dotnet-testcontainers/issues/333 regarding integration of TestContainer in CI Pipeline. I have a similar problem.

I use Bitbucket to run tests, here is my pipeline (apologies for indent):


image: mcr.microsoft.com/dotnet/core/sdk:3.1

options:
docker: true

pipelines:
default:
- step:
script:
- docker ps
- dotnet restore
- dotnet test ModelRunnerSvc.Tests
services:
- docker
caches:
- docker

Notice that I run `docker ps` in order two check if docker is available and it seems Ok.
When I run the pipeline, here is the result:


A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:01.42] ModelRunnerSvc.Tests.JobControllerTest.SubmitModel_GetJob_WhenCalled_ReturnsJob [FAIL]
[xUnit.net 00:00:01.46] ModelRunnerSvc.Tests.JobControllerTest.Submit3Models_GetJobs_WhenCalled_Returns3Jobs [FAIL]
[xUnit.net 00:00:01.53] ModelRunnerSvc.Tests.JobControllerTest.GetJob_WhenCalled_ReturnsEmptyResult [FAIL]
X ModelRunnerSvc.Tests.JobControllerTest.SubmitModel_GetJob_WhenCalled_ReturnsJob [479ms]
Error Message:
System.Net.Http.HttpRequestException : Connection failed
---- System.Net.Internals.SocketExceptionFactory+ExtendedSocketException : Cannot assign requested address /var/run/docker.sock
Stack Trace:
at Microsoft.Net.Http.Client.ManagedHandler.ProcessRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Net.Http.Client.ManagedHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Docker.DotNet.DockerClient.PrivateMakeRequestAsync(TimeSpan timeout, HttpCompletionOption completionOption, HttpMethod method, String path, IQueryString queryString, IDictionary`2 headers, IRequestContent data, CancellationToken cancellationToken)
at Docker.DotNet.DockerClient.PrivateMakeRequestAsync(TimeSpan timeout, HttpCompletionOption completionOption, HttpMethod method, String path, IQueryString queryString, IDictionary`2 headers, IRequestContent data, CancellationToken cancellationToken)
at Docker.DotNet.DockerClient.MakeRequestAsync(IEnumerable`1 errorHandlers, HttpMethod method, String path, IQueryString queryString, IRequestContent body, IDictionary`2 headers, TimeSpan timeout, CancellationToken token)
at Docker.DotNet.ImageOperations.ListImagesAsync(ImagesListParameters parameters, CancellationToken cancellationToken)
at DotNet.Testcontainers.Clients.DockerImageOperations.ByPropertyAsync(String property, String value, CancellationToken ct)
at DotNet.Testcontainers.Clients.DockerImageOperations.ExistsWithNameAsync(String name, CancellationToken ct)
at DotNet.Testcontainers.Clients.TestcontainersClient.RunAsync(ITestcontainersConfiguration configuration, CancellationToken ct)
at DotNet.Testcontainers.Containers.Modules.TestcontainersContainer.Create(CancellationToken ct)
at DotNet.Testcontainers.Containers.Modules.TestcontainersContainer.StartAsync(CancellationToken ct)
at ModelRunnerSvc.Tests.JobControllerTest.SubmitModel_GetJob_WhenCalled_ReturnsJob() in /opt/atlassian/pipelines/agent/build/ModelRunnerSvc.Tests/JobControllerTest.cs:line 96
at ModelRunnerSvc.Tests.JobControllerTest.SubmitModel_GetJob_WhenCalled_ReturnsJob() in /opt/atlassian/pipelines/agent/build/ModelRunnerSvc.Tests/JobControllerTest.cs:line 111

The issue seems to be around Cannot assign requested address /var/run/docker.sock
Any idea on how to solve it ?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍂📹 Apptoberfest demo contest roundup: vote for your favorite demos!

Hi Community! The submissions are in (and listed below) for the 🍻🍂Apptoberfest🍂🍻 Demo Competition and it’s time for you to place your votes for the best: Analytics & reporting app demo ...

130 views 2 11
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you