File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed
ManagedCode.Database.Tests/TestContainers Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -77,25 +77,20 @@ public async Task InitializeAsync()
7777 containerExsist = true ;
7878 }
7979
80- if ( ! containerExsist )
80+ var listContainers = await _dockerClient . Containers . ListContainersAsync ( new ContainersListParameters ( ) ) ;
81+
82+ ContainerListResponse containerListResponse = listContainers . FirstOrDefault ( container => container . Names . Contains ( $ "/{ containerName } ") ) ;
83+
84+ if ( containerListResponse != null )
8185 {
82- publicPort = _cosmosTestContainer . GetMappedPublicPort ( privatePort ) ;
83- containerId = _cosmosTestContainer . Id ;
86+ //publicPort = containerListResponse.Ports.Single(port => port.PrivatePort == privatePort).PublicPort;
87+ publicPort = containerListResponse . Ports . FirstOrDefault ( ) . PublicPort ;
88+
89+ containerId = containerListResponse . ID ;
8490 }
85- else
86- {
87- var listContainers = await _dockerClient . Containers . ListContainersAsync ( new ContainersListParameters ( ) ) ;
8891
89- ContainerListResponse containerListResponse = listContainers . FirstOrDefault ( container => container . Names . Contains ( $ "/{ containerName } ") ) ;
9092
91- if ( containerListResponse != null )
92- {
93- publicPort = containerListResponse . Ports . Single ( port => port . PrivatePort == privatePort ) . PublicPort ;
9493
95- containerId = containerListResponse . ID ;
96- }
97- }
98-
9994 _database = new CosmosDatabase ( new CosmosOptions
10095 {
10196 ConnectionString =
You can’t perform that action at this time.
0 commit comments