@@ -32,19 +32,25 @@ public CosmosTestContainer()
32
32
. WithImage ( "mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator" )
33
33
. WithName ( containerName )
34
34
. WithExposedPort ( 8081 )
35
+ . WithExposedPort ( 10250 )
36
+ . WithExposedPort ( 10251 )
37
+ . WithExposedPort ( 10252 )
38
+ . WithExposedPort ( 10253 )
39
+ . WithExposedPort ( 10254 )
40
+ . WithExposedPort ( 10255 )
35
41
. WithPortBinding ( 8081 , 8081 )
36
42
. WithPortBinding ( 10250 , 10250 )
37
43
. WithPortBinding ( 10251 , 10251 )
38
44
. WithPortBinding ( 10252 , 10252 )
39
45
. WithPortBinding ( 10253 , 10253 )
40
46
. WithPortBinding ( 10254 , 10254 )
41
47
. WithPortBinding ( 10255 , 10255 )
42
- . WithEnvironment ( "AZURE_COSMOS_EMULATOR_PARTITION_COUNT" , "2 " )
48
+ . WithEnvironment ( "AZURE_COSMOS_EMULATOR_PARTITION_COUNT" , "1 " )
43
49
. WithEnvironment ( "AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE" , "127.0.0.1" )
44
- . WithEnvironment ( "AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE" , "true " )
50
+ . WithEnvironment ( "AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE" , "false " )
45
51
. WithCleanUp ( false )
46
52
. WithWaitStrategy ( Wait . ForUnixContainer ( )
47
- . UntilPortIsAvailable ( 8081 ) )
53
+ . UntilPortIsAvailable ( privatePort ) )
48
54
. Build ( ) ;
49
55
50
56
_dockerClient = new DockerClientConfiguration ( ) . CreateClient ( ) ;
@@ -60,7 +66,7 @@ public string GenerateId()
60
66
61
67
public async Task InitializeAsync ( )
62
68
{
63
- ushort publicPort = 0 ;
69
+ ushort publicPort = privatePort ;
64
70
65
71
try
66
72
{
@@ -92,12 +98,13 @@ public async Task InitializeAsync()
92
98
}
93
99
}
94
100
101
+ var database = $ "db{ Guid . NewGuid ( ) . ToString ( "N" ) } ";
95
102
96
103
_database = new CosmosDatabase ( new CosmosOptions
97
104
{
98
105
ConnectionString =
99
106
$ "AccountEndpoint=https://localhost:{ publicPort } /;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==",
100
- DatabaseName = " database" ,
107
+ DatabaseName = database ,
101
108
CollectionName = $ "testContainer",
102
109
AllowTableCreation = true ,
103
110
CosmosClientOptions = new CosmosClientOptions ( )
0 commit comments