Skip to content

Commit 72289af

Browse files
author
Oleksii Sokol
committed
test
1 parent f503b66 commit 72289af

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ManagedCode.Database.Tests/TestContainers/CosmosTestContainer.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class CosmosTestContainer : ITestContainer<string, TestCosmosItem>,
2222
private CosmosDatabase _database;
2323
private DockerClient _dockerClient;
2424
private const string containerName = "cosmosContainer";
25-
private const ushort privatePort = 8081;
25+
private ushort privatePort = 8081;
2626
private bool containerExsist = false;
2727
private string containerId;
2828

@@ -76,24 +76,25 @@ public async Task InitializeAsync()
7676
containerExsist = true;
7777
}
7878

79-
if (!containerExsist)
79+
/*if (!containerExsist)
8080
{
8181
publicPort = _cosmosTestContainer.GetMappedPublicPort(privatePort);
8282
containerId = _cosmosTestContainer.Id;
8383
}
8484
else
85-
{
85+
{*/
8686
var listContainers = await _dockerClient.Containers.ListContainersAsync(new ContainersListParameters());
8787

8888
ContainerListResponse containerListResponse = listContainers.FirstOrDefault(container => container.Names.Contains($"/{containerName}"));
8989

9090
if (containerListResponse != null)
9191
{
92+
privatePort = containerListResponse.Ports.LastOrDefault().PrivatePort;
9293
publicPort = containerListResponse.Ports.Single(port => port.PrivatePort == privatePort).PublicPort;
9394

9495
containerId = containerListResponse.ID;
9596
}
96-
}
97+
// }
9798

9899
var httpMessageHandler = new HttpClientHandler()
99100
{

0 commit comments

Comments
 (0)