Skip to content
Merged
Show file tree
Hide file tree
Changes from 112 commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
e26c10b
Fixing CI pipeline.
jeet1995 Jan 2, 2024
83ead01
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java
jeet1995 Jan 5, 2024
a05afc7
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java
jeet1995 Jan 12, 2024
fd240f5
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java
jeet1995 Jan 17, 2024
e27b39c
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java
jeet1995 Jan 30, 2024
f3b7eea
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java
jeet1995 Feb 12, 2024
552580c
Added skeletal classes.
jeet1995 Mar 13, 2024
097f7a5
Added skeletal classes and method calls.
jeet1995 Mar 14, 2024
e97f50b
Added skeletal classes and method calls.
jeet1995 Mar 15, 2024
7bac0f7
Added skeletal flow for marking a partition as unavailable for read /…
jeet1995 Mar 16, 2024
ed15a83
Added skeletal flow for marking a partition as unavailable for read /…
jeet1995 Mar 18, 2024
e4b0cd8
Adding skeletal methods to GlobalPartitionEndpointManagerForCircuitBr…
jeet1995 Mar 19, 2024
1ae1382
Adding skeletal methods to GlobalPartitionEndpointManagerForCircuitBr…
jeet1995 Mar 20, 2024
7a9f32b
Updated CHANGELOG.
jeet1995 Mar 21, 2024
610af34
Added class to error track on a per-region basis.
jeet1995 Mar 22, 2024
af6b6b3
Refactor region health transitions.
jeet1995 Mar 22, 2024
207c268
Added class to error track on a per-region basis.
jeet1995 Mar 24, 2024
9e56e8c
Adapt point operations to bookmark failures.
jeet1995 Mar 26, 2024
ddb19f7
Wiring region feedback handling for point operations.
jeet1995 Mar 26, 2024
1845447
Fixing compilation errors.
jeet1995 Mar 28, 2024
d24e0a4
Added partitionKeyRange detection for point operations in document cl…
jeet1995 Mar 29, 2024
d07e810
Updated CHANGELOG.md.
jeet1995 Apr 23, 2024
5c0468e
Fixing partition state transition logic.
jeet1995 Apr 24, 2024
647dcc6
Modify logger level.
jeet1995 Apr 26, 2024
7974575
Adding a way to exclude partition-level unavailable regions.
jeet1995 Apr 29, 2024
84cc95a
Adding a way to exclude partition-level unavailable regions for queries.
jeet1995 Apr 30, 2024
5e3ca33
Adding circuit breaking for 408s in point operations.
jeet1995 May 1, 2024
ebdbd8f
Handling 408 cases for queries.
jeet1995 May 8, 2024
c835a77
Adding shared state for point and query operations with availability …
jeet1995 May 11, 2024
20e2f5c
Implementing 408 handling for partition-level circuit breaker.
jeet1995 May 13, 2024
9998068
Implementing 408 handling for partition-level circuit breaker.
jeet1995 May 13, 2024
5007f9d
Implementing 408 handling for partition-level circuit breaker.
jeet1995 May 13, 2024
205d837
Implementing 408 handling for partition-level circuit breaker.
jeet1995 May 13, 2024
2a44336
Code refactor.
jeet1995 May 14, 2024
247c9a7
Test changes and multi-container fixes.
jeet1995 May 18, 2024
47cc306
Integrate readMany for partition-level circuit breaker.
jeet1995 May 20, 2024
37f1ae2
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 May 20, 2024
169c1ba
Fixing merge.
jeet1995 May 20, 2024
d2203cd
Fixing CI pipeline.
jeet1995 May 21, 2024
0443b68
Fixing CI pipeline.
jeet1995 May 21, 2024
9a61204
Fixing CI pipeline.
jeet1995 May 21, 2024
ebadbf3
Fixing CI pipeline.
jeet1995 May 21, 2024
0eca231
Integrating circuit breaking behavior for change feed.
jeet1995 May 21, 2024
cf8bcb7
Integrating circuit breaking behavior for change feed.
jeet1995 May 21, 2024
e26c963
Added separate exception / success counters for write / non-write ope…
jeet1995 May 22, 2024
2de5bda
Added separate exception / success counters for write / non-write ope…
jeet1995 May 23, 2024
649d934
Added separate exception / success counters for write / non-write ope…
jeet1995 May 23, 2024
dc3dcc1
Adding `Healthy` status.
jeet1995 May 28, 2024
152c116
Adding `CosmosDiagnostics` for change feed `FeedResponse`.
jeet1995 May 29, 2024
0f92454
Refactoring.
jeet1995 May 29, 2024
925170c
Refactoring.
jeet1995 May 29, 2024
e2dad7b
Refactoring.
jeet1995 May 29, 2024
de3991c
Fixing CI pipeline.
jeet1995 May 30, 2024
d62d188
Fixing CI pipeline.
jeet1995 May 30, 2024
b75f6d0
Fixing CI pipeline.
jeet1995 May 30, 2024
a6c960b
Fixing CI pipeline.
jeet1995 May 30, 2024
576d97b
Fixing CI pipeline.
jeet1995 May 30, 2024
9e064ae
Fixing CI pipeline.
jeet1995 May 30, 2024
ffaf826
Fixing CI pipeline.
jeet1995 May 30, 2024
3c41234
Refactoring.
jeet1995 May 31, 2024
7d0d882
Refactoring.
jeet1995 May 31, 2024
678ec7f
Fixing CI pipeline.
jeet1995 May 31, 2024
7e0029a
Fixing CI pipeline.
jeet1995 Jun 1, 2024
f8dba2e
Handle server-generated 500 errors for circuit breaking purposes.
jeet1995 Jun 1, 2024
f66a255
Handling stale collection cache with retries.
jeet1995 Jun 1, 2024
9ac1ff5
Handling stale collection cache with retries.
jeet1995 Jun 1, 2024
d6d4545
Adding tests.
jeet1995 Jun 4, 2024
fda4bca
Adding tests.
jeet1995 Jun 5, 2024
fa151c2
Adding tests.
jeet1995 Jun 14, 2024
6797c22
Fixing CI pipeline.
jeet1995 Jun 14, 2024
cb4f1d9
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 Jun 14, 2024
cbb5ff8
Fixing faulty merge.
jeet1995 Jun 14, 2024
d391a1c
Fixing CI pipeline.
jeet1995 Jun 14, 2024
7e1fd08
Fixing CI pipeline.
jeet1995 Jun 14, 2024
2fffc2c
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 Jun 14, 2024
6c6760d
Fixing CI pipeline.
jeet1995 Jun 14, 2024
b0f377c
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 Jun 14, 2024
3ca4da9
Fixing CI pipeline.
jeet1995 Jun 15, 2024
6c90d25
Fixing CI pipeline.
jeet1995 Jun 15, 2024
a648304
Fixing CI pipeline.
jeet1995 Jun 15, 2024
9060f3f
Fixing CI pipeline.
jeet1995 Jun 15, 2024
9fb79dd
Fixing live tests pipeline.
jeet1995 Jun 17, 2024
7472e3b
Fixing live tests pipeline.
jeet1995 Jun 18, 2024
94e89d2
Refactoring.
jeet1995 Jun 18, 2024
e7e2ab7
Refactoring.
jeet1995 Jun 18, 2024
d94ecb6
Refactoring.
jeet1995 Jun 18, 2024
a7e8edf
Refactoring.
jeet1995 Jun 18, 2024
cfd8bb6
Fixing tests.
jeet1995 Jun 19, 2024
552e4ff
Fixing tests.
jeet1995 Jun 19, 2024
0e4fdbe
Refactoring.
jeet1995 Jun 19, 2024
58a2bde
Refactoring.
jeet1995 Jun 19, 2024
d5372fd
Refactoring.
jeet1995 Jun 19, 2024
b06aca1
Refactoring.
jeet1995 Jun 19, 2024
c30090d
Adding code comments.
jeet1995 Jun 20, 2024
ef2775e
Adding code comments.
jeet1995 Jun 20, 2024
4e31fbe
Modifying way to configure circuit breaker thresholds.
jeet1995 Jun 21, 2024
007a1c2
Adding capability to specify alternate account to upload benchmark re…
jeet1995 Jun 24, 2024
b5bfdec
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 Jun 24, 2024
9ba09a4
Fixing merge.
jeet1995 Jun 24, 2024
0f0455a
Reacting to review comments.
jeet1995 Jun 24, 2024
652eb17
Refactoring tests.
jeet1995 Jun 24, 2024
8b3b258
Fixing tests.
jeet1995 Jun 26, 2024
8990165
Fixing tests.
jeet1995 Jun 26, 2024
f98f087
Fixing tests.
jeet1995 Jun 26, 2024
471586d
Reacting to review comments.
jeet1995 Jun 27, 2024
2e748cb
Reacting to review comments.
jeet1995 Jun 29, 2024
d60adda
Reacting to review comments.
jeet1995 Jun 29, 2024
6db23c2
Reacting to review comments.
jeet1995 Jun 29, 2024
5295c88
Fixing tests.
jeet1995 Jun 30, 2024
dceec50
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 Jun 30, 2024
e282d61
Fixing merge conflicts.
jeet1995 Jun 30, 2024
e7b65a3
Refactoring.
jeet1995 Jul 1, 2024
b950b90
Refactoring.
jeet1995 Jul 2, 2024
12f7c1f
Refactoring.
jeet1995 Jul 2, 2024
618bb71
Reacting to review comments.
jeet1995 Jul 2, 2024
e36ecbd
Reacting to review comments.
jeet1995 Jul 2, 2024
acdcc50
Reacting to review comments.
jeet1995 Jul 5, 2024
3b42c8e
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 Jul 5, 2024
89446c4
Reacting to review comments.
jeet1995 Jul 5, 2024
e43016d
Fixing live tests pipeline.
jeet1995 Jul 5, 2024
ea80aab
Fixing live tests pipeline.
jeet1995 Jul 5, 2024
ba695cf
Fixing live tests pipeline.
jeet1995 Jul 6, 2024
7a2f381
Fixing live tests pipeline.
jeet1995 Jul 6, 2024
ad0fd51
Fixing live tests pipeline.
jeet1995 Jul 6, 2024
fceaa31
Fixing CI pipeline.
jeet1995 Jul 6, 2024
8a47de3
Fixing CI pipeline.
jeet1995 Jul 6, 2024
a24f3a4
Fixing CI pipeline.
jeet1995 Jul 7, 2024
fbe3e7c
Refactoring.
jeet1995 Jul 7, 2024
5a9a0e6
Refactoring.
jeet1995 Jul 7, 2024
d3a090b
Refactoring.
jeet1995 Jul 7, 2024
6e99cb8
Refactoring.
jeet1995 Jul 7, 2024
b2e23e7
Refactoring.
jeet1995 Jul 7, 2024
9b29f55
Refactoring.
jeet1995 Jul 8, 2024
d069d39
Refactoring.
jeet1995 Jul 8, 2024
e982cfe
Refactoring and reacting to review comments.
jeet1995 Jul 9, 2024
271e25f
Refactoring.
jeet1995 Jul 10, 2024
491a529
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 Jul 10, 2024
05e6c06
Refactoring.
jeet1995 Jul 10, 2024
a51ed16
Refactoring.
jeet1995 Jul 10, 2024
d39017b
Fixing test pipeline.
jeet1995 Jul 11, 2024
8ec2079
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 Jul 13, 2024
63e4d76
Reacting to review comments.
jeet1995 Jul 14, 2024
3120504
Modify test pipeline timeout.
jeet1995 Jul 14, 2024
8194c10
Reacting to review comments.
jeet1995 Jul 15, 2024
929196f
Reacting to review comments.
jeet1995 Jul 16, 2024
c405061
Reacting to review comments.
jeet1995 Jul 16, 2024
13a710f
Reacting to review comments.
jeet1995 Jul 17, 2024
15fe11b
Reacting to review comments.
jeet1995 Jul 17, 2024
6826f65
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 Jul 17, 2024
36109f1
Fixing CI pipeline.
jeet1995 Jul 17, 2024
ca0313b
Fixing CI pipeline.
jeet1995 Jul 18, 2024
d878c10
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 Jul 19, 2024
e45f1e9
Fixing CI pipeline.
jeet1995 Jul 19, 2024
f5a6218
Fixing CI pipeline.
jeet1995 Jul 19, 2024
ac8d848
Updated CHANGELOG.md.
jeet1995 Jul 22, 2024
fb59af5
Added code comments.
jeet1995 Jul 22, 2024
6e1f8a7
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Pa…
jeet1995 Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ abstract class AsyncBenchmark<T> {
logger = LoggerFactory.getLogger(this.getClass());
configuration = cfg;

if (configuration.isPartitionLevelCircuitBreakerEnabled()) {
System.setProperty(
"COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG",
"{\"isPartitionLevelCircuitBreakerEnabled\": true, "
+ "\"circuitBreakerType\": \"CONSECUTIVE_EXCEPTION_COUNT_BASED\","
+ "\"consecutiveExceptionCountToleratedForReads\": 10,"
+ "\"consecutiveExceptionCountToleratedForWrites\": 5,"
+ "}");
}

CosmosClientBuilder cosmosClientBuilder = new CosmosClientBuilder()
.endpoint(cfg.getServiceEndpoint())
.key(cfg.getMasterKey())
Expand Down Expand Up @@ -138,8 +148,11 @@ abstract class AsyncBenchmark<T> {
cosmosClientBuilder = cosmosClientBuilder.gatewayMode(gatewayConnectionConfig);
}

CosmosClient syncClient = cosmosClientBuilder.buildClient();
cosmosClient = cosmosClientBuilder.buildAsyncClient();
CosmosClient syncClient = cosmosClientBuilder
.endpoint(configuration.getServiceEndpointForRunResultsUploadAccount())
.key(configuration.getMasterKeyForRunResultsUploadAccount())
.buildClient();

try {
cosmosAsyncDatabase = cosmosClient.getDatabase(this.configuration.getDatabaseId());
Expand Down Expand Up @@ -168,6 +181,17 @@ abstract class AsyncBenchmark<T> {
).block();

cosmosAsyncContainer = cosmosAsyncDatabase.getContainer(this.configuration.getCollectionId());

// add some delay to allow container to be created across multiple regions
// container creation across regions is an async operation
// without the delay a container may not be available to process reads / writes

try {
Thread.sleep(30_000);
} catch (Exception exception) {
throw new RuntimeException(exception);
}

logger.info("Collection {} is created for this test", this.configuration.getCollectionId());
collectionCreated = true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public class Configuration {
@Parameter(names = "-masterKey", description = "Master Key")
private String masterKey;

@Parameter(names = "-serviceEndpointForResultsUploadAccount", description = "Service Endpoint for run results upload account")
private String serviceEndpointForRunResultsUploadAccount;

@Parameter(names = "-masterKeyForResultsUploadAccount", description = "Master Key for run results upload account")
private String masterKeyForRunResultsUploadAccount;

@Parameter(names = "-databaseId", description = "Database ID")
private String databaseId;

Expand Down Expand Up @@ -137,6 +143,9 @@ public class Configuration {
@Parameter(names = "-isRegionScopedSessionContainerEnabled", description = "A flag to denote whether region scoped session container is enabled")
private String isRegionScopedSessionContainerEnabled = String.valueOf(false);

@Parameter(names = "isPartitionLevelCircuitBreakerEnabled", description = "A flag to denote whether partition level circuit breaker is enabled.")
private String isPartitionLevelCircuitBreakerEnabled = String.valueOf(true);

@Parameter(names = "-operation", description = "Type of Workload:\n"
+ "\tReadThroughput- run a READ workload that prints only throughput *\n"
+ "\tReadThroughputWithMultipleClients - run a READ workload that prints throughput and latency for multiple client read.*\n"
Expand Down Expand Up @@ -397,6 +406,14 @@ public String getMasterKey() {
return masterKey;
}

public String getServiceEndpointForRunResultsUploadAccount() {
return serviceEndpointForRunResultsUploadAccount;
}

public String getMasterKeyForRunResultsUploadAccount() {
return masterKeyForRunResultsUploadAccount;
}

public String getApplicationName() {
return applicationName;
}
Expand Down Expand Up @@ -639,6 +656,10 @@ public boolean isRegionScopedSessionContainerEnabled() {
return Boolean.parseBoolean(isRegionScopedSessionContainerEnabled);
}

public boolean isPartitionLevelCircuitBreakerEnabled() {
return Boolean.parseBoolean(isPartitionLevelCircuitBreakerEnabled);
}

public void tryGetValuesFromSystem() {
serviceEndpoint = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("SERVICE_END_POINT")),
serviceEndpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ public T apply(T o, Throwable throwable) {
configuration = cfg;
logger = LoggerFactory.getLogger(this.getClass());

if (configuration.isPartitionLevelCircuitBreakerEnabled()) {
System.setProperty(
"COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG",
"{\"isPartitionLevelCircuitBreakerEnabled\": true, "
+ "\"circuitBreakerType\": \"CONSECUTIVE_EXCEPTION_COUNT_BASED\","
+ "\"consecutiveExceptionCountToleratedForReads\": 10,"
+ "\"consecutiveExceptionCountToleratedForWrites\": 5,"
+ "}");
}

CosmosClientBuilder cosmosClientBuilder = new CosmosClientBuilder()
.endpoint(cfg.getServiceEndpoint())
.preferredRegions(cfg.getPreferredRegionsList())
Expand Down Expand Up @@ -147,6 +157,11 @@ public T apply(T o, Throwable throwable) {
}

cosmosClient = cosmosClientBuilder.buildClient();
CosmosClient syncClient = cosmosClientBuilder
.endpoint(configuration.getServiceEndpointForRunResultsUploadAccount())
.key(configuration.getMasterKeyForRunResultsUploadAccount())
.buildClient();

try {
cosmosDatabase = cosmosClient.getDatabase(this.configuration.getDatabaseId());
cosmosDatabase.read();
Expand All @@ -171,6 +186,16 @@ public T apply(T o, Throwable throwable) {
ThroughputProperties.createManualThroughput(this.configuration.getThroughput()));
cosmosContainer = cosmosDatabase.getContainer(this.configuration.getCollectionId());
logger.info("Collection {} is created for this test", this.configuration.getCollectionId());

// add some delay to allow container to be created across multiple regions
// container creation across regions is an async operation
// without the delay a container may not be available to process reads / writes
try {
Thread.sleep(30_000);
} catch (Exception exception) {
throw new RuntimeException(exception);
}

collectionCreated = true;
} else {
throw e;
Expand Down Expand Up @@ -236,7 +261,7 @@ public T apply(T o, Throwable throwable) {
resultReporter = CosmosTotalResultReporter
.forRegistry(
metricsRegistry,
cosmosClient.getDatabase(configuration.getResultUploadDatabase()).getContainer(configuration.getResultUploadContainer()),
syncClient.getDatabase(configuration.getResultUploadDatabase()).getContainer(configuration.getResultUploadContainer()),
configuration)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.azure.cosmos.CosmosRegionSwitchHint;
import com.azure.cosmos.SessionRetryOptions;
import com.azure.cosmos.SessionRetryOptionsBuilder;
import com.azure.cosmos.implementation.circuitBreaker.PartitionLevelCircuitBreakerConfig;
import com.azure.cosmos.implementation.directconnectivity.RntbdTransportClient;
import com.azure.cosmos.implementation.guava25.collect.ImmutableList;
import com.azure.cosmos.implementation.http.HttpClientConfig;
Expand Down Expand Up @@ -73,7 +74,8 @@ public Object[][] clientCfgProvider() {
aggressiveWarmUpDuration1,
proactiveConnectionRegionCount1,
cosmosContainerIdentities,
false // is region scoped session capturing enabled
false, // is region scoped session capturing enabled
false // is partition-level circuit breaking enabled
},
{
new CosmosContainerProactiveInitConfigBuilder(cosmosContainerIdentities)
Expand All @@ -83,7 +85,8 @@ public Object[][] clientCfgProvider() {
aggressiveWarmUpDuration2,
proactiveConnectionRegionCount2,
cosmosContainerIdentities,
true
true, // is region scoped session capturing enabled
false // is partition-level circuit breaking enabled
},
{
new CosmosContainerProactiveInitConfigBuilder(cosmosContainerIdentities)
Expand All @@ -92,7 +95,8 @@ public Object[][] clientCfgProvider() {
null,
proactiveConnectionRegionCount3,
cosmosContainerIdentities,
false
false, // is region scoped session capturing enabled
true // is partition-level circuit breaking enabled
}
};
}
Expand Down Expand Up @@ -243,7 +247,8 @@ public void full(
Duration aggressiveWarmupDuration,
int proactiveConnectionRegionCount,
List<CosmosContainerIdentity> cosmosContainerIdentities,
boolean isRegionScopedSessionCapturingEnabled) throws Exception {
boolean isRegionScopedSessionCapturingEnabled,
boolean isPartitionLevelCircuitBreakerEnabled) throws Exception {

DiagnosticsClientContext clientContext = Mockito.mock(DiagnosticsClientContext.class);
System.setProperty("COSMOS.REPLICA_ADDRESS_VALIDATION_ENABLED", "false");
Expand Down Expand Up @@ -277,6 +282,19 @@ public void full(
diagnosticsClientConfig.withRegionScopedSessionContainerOptions(regionScopedSessionContainer);
}

if (isPartitionLevelCircuitBreakerEnabled) {
System.setProperty(
"COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG",
"{\"isPartitionLevelCircuitBreakerEnabled\": true, "
+ "\"circuitBreakerType\": \"CONSECUTIVE_EXCEPTION_COUNT_BASED\","
+ "\"consecutiveExceptionCountToleratedForReads\": 10,"
+ "\"consecutiveExceptionCountToleratedForWrites\": 5,"
+ "}");

PartitionLevelCircuitBreakerConfig partitionLevelCircuitBreakerConfig = Configs.getPartitionLevelCircuitBreakerConfig();
diagnosticsClientConfig.withPartitionLevelCircuitBreakerConfig(partitionLevelCircuitBreakerConfig);
}

Mockito.doReturn(diagnosticsClientConfig).when(clientContext).getConfig();

StringWriter jsonWriter = new StringWriter();
Expand All @@ -301,11 +319,18 @@ public void full(
assertThat(objectNode.get("regionScopedSessionCfg")).isNull();
}

if (isPartitionLevelCircuitBreakerEnabled) {
assertThat(objectNode.get("partitionLevelCircuitBreakerCfg").asText()).isEqualTo("(cb: true, type: CONSECUTIVE_EXCEPTION_COUNT_BASED, rexcntt: 10, wexcntt: 5)");
} else {
assertThat(objectNode.get("partitionLevelCircuitBreakerCfg")).isNull();
}

String expectedProactiveInitConfigString = reconstructProactiveInitConfigString(cosmosContainerIdentities, aggressiveWarmupDuration, proactiveConnectionRegionCount);

assertThat(objectNode.get("proactiveInitCfg").asText()).isEqualTo(expectedProactiveInitConfigString);

System.clearProperty("COSMOS.REPLICA_ADDRESS_VALIDATION_ENABLED");
System.clearProperty("COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG");
}

@Test(groups = {"unit"}, dataProvider = "sessionRetryOptionsConfigProvider")
Expand Down
Loading