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()
77
77
containerExsist = true ;
78
78
}
79
79
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 )
81
85
{
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 ;
84
90
}
85
- else
86
- {
87
- var listContainers = await _dockerClient . Containers . ListContainersAsync ( new ContainersListParameters ( ) ) ;
88
91
89
- ContainerListResponse containerListResponse = listContainers . FirstOrDefault ( container => container . Names . Contains ( $ "/{ containerName } ") ) ;
90
92
91
- if ( containerListResponse != null )
92
- {
93
- publicPort = containerListResponse . Ports . Single ( port => port . PrivatePort == privatePort ) . PublicPort ;
94
93
95
- containerId = containerListResponse . ID ;
96
- }
97
- }
98
-
99
94
_database = new CosmosDatabase ( new CosmosOptions
100
95
{
101
96
ConnectionString =
You can’t perform that action at this time.
0 commit comments