Skip to content

Commit 7157e1c

Browse files
jeet1995Copilot
andcommitted
Simplify PPCB E2E diagnostics test to verify unconditional clientCfgs keys
The partitionLevelCircuitBreakerCfg field now appears in clientCfgs for every client regardless of PPCB configuration, so the E2E test no longer sets the COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG system property. It just builds a plain client and asserts all expected clientCfgs keys (including partitionLevelCircuitBreakerCfg) are present in CosmosDiagnostics. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent afa7a51 commit 7157e1c

1 file changed

Lines changed: 10 additions & 22 deletions

File tree

sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/PerPartitionCircuitBreakerE2ETests.java

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4616,23 +4616,16 @@ public void validateHandlingOnNullPartitionKeyRangeOnSmallE2ETimeout_allOps(Oper
46164616
/**
46174617
* Regression validation for the Per-Partition Circuit Breaker (PPCB) diagnostics fix (see PR 49734).
46184618
*
4619-
* When PPCB is explicitly enabled via the {@code COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG}
4620-
* system property, the {@code clientCfgs} section of the emitted {@link CosmosDiagnostics} must
4621-
* include the {@code partitionLevelCircuitBreakerCfg} field. A prior regression silently dropped
4622-
* this field. This test asserts that all the expected {@code clientCfgs} keys - including
4623-
* {@code partitionLevelCircuitBreakerCfg} - are present in the diagnostics of a real operation.
4619+
* The {@code clientCfgs} section of the emitted {@link CosmosDiagnostics} must always include the
4620+
* {@code partitionLevelCircuitBreakerCfg} field for every client, regardless of whether PPCB is
4621+
* explicitly enabled. A prior regression silently dropped this field unless PPAF mandated it. This
4622+
* test asserts that all the expected {@code clientCfgs} keys - including
4623+
* {@code partitionLevelCircuitBreakerCfg} - are present in the diagnostics of a real operation
4624+
* without setting any PPCB configuration.
46244625
*/
46254626
@Test(groups = { "circuit-breaker-misc-gateway", "circuit-breaker-misc-direct", "circuit-breaker-read-all-read-many", "multi-region", "fi-thinclient-multi-master" }, timeOut = TIMEOUT)
46264627
public void partitionLevelCircuitBreakerConfigIsPresentInClientCfgsDiagnostics() {
46274628

4628-
System.setProperty(
4629-
"COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG",
4630-
"{\"isPartitionLevelCircuitBreakerEnabled\": true, "
4631-
+ "\"circuitBreakerType\": \"CONSECUTIVE_EXCEPTION_COUNT_BASED\","
4632-
+ "\"consecutiveExceptionCountToleratedForReads\": 10,"
4633-
+ "\"consecutiveExceptionCountToleratedForWrites\": 5,"
4634-
+ "}");
4635-
46364629
try (CosmosAsyncClient client = getClientBuilder().buildAsyncClient()) {
46374630

46384631
CosmosAsyncContainer container = client
@@ -4653,7 +4646,8 @@ public void partitionLevelCircuitBreakerConfigIsPresentInClientCfgsDiagnostics()
46534646
.as("clientCfgs section should be present in the CosmosDiagnostics")
46544647
.contains("\"clientCfgs\"");
46554648

4656-
// All the clientCfgs keys unconditionally emitted by DiagnosticsClientConfigSerializer.
4649+
// All the clientCfgs keys unconditionally emitted by DiagnosticsClientConfigSerializer,
4650+
// including partitionLevelCircuitBreakerCfg (the field the regression previously dropped).
46574651
List<String> expectedClientCfgsKeys = Arrays.asList(
46584652
"id",
46594653
"machineId",
@@ -4667,20 +4661,14 @@ public void partitionLevelCircuitBreakerConfigIsPresentInClientCfgsDiagnostics()
46674661
"consistencyCfg",
46684662
"proactiveInitCfg",
46694663
"e2ePolicyCfg",
4670-
"sessionRetryCfg");
4664+
"sessionRetryCfg",
4665+
"partitionLevelCircuitBreakerCfg");
46714666

46724667
for (String expectedKey : expectedClientCfgsKeys) {
46734668
assertThat(diagnosticsString)
46744669
.as("clientCfgs key '%s' should be present in the CosmosDiagnostics", expectedKey)
46754670
.contains("\"" + expectedKey + "\"");
46764671
}
4677-
4678-
// The regression fix: PPCB config must be present in clientCfgs when explicitly enabled.
4679-
assertThat(diagnosticsString)
4680-
.as("partitionLevelCircuitBreakerCfg should be present in clientCfgs when PPCB is enabled")
4681-
.contains("\"partitionLevelCircuitBreakerCfg\"");
4682-
} finally {
4683-
System.clearProperty("COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG");
46844672
}
46854673
}
46864674

0 commit comments

Comments
 (0)