Skip to content

Commit 28b1fae

Browse files
mbhaskarCopilot
andcommitted
Fix E2E tests: skip on single-region emulator
Read and write barrier requests are only triggered on multi-region strong consistency accounts (numberOfReadRegions > 0). The emulator is single-region, so the GCLSN interceptor never triggers barriers and the tests fail with empty supplementalResponseStatisticsList. Added accountLevelReadRegions.size() > 1 skip check to all three E2E fault injection tests so they correctly skip on single-region environments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 685074e commit 28b1fae

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/faultinjection/FaultInjectionServerErrorRuleOnDirectTests.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,11 +1821,17 @@ private static boolean isOperationAWriteOperation(OperationType operationType) {
18211821
public void faultInjection_readBarrierThrottled_yieldsEarly() throws JsonProcessingException {
18221822
// Validates that when barrier HEAD requests are throttled (429) during a strong read,
18231823
// the early yield mechanism fires and the 429 is propagated to the caller.
1824+
// This test requires a multi-region strong consistency account because read barriers
1825+
// are only triggered when numberOfReadRegions > 0.
18241826

18251827
if (this.databaseAccount.getConsistencyPolicy().getDefaultConsistencyLevel() != ConsistencyLevel.STRONG) {
18261828
throw new SkipException("Test only applicable to STRONG consistency level.");
18271829
}
18281830

1831+
if (this.accountLevelReadRegions.size() <= 1) {
1832+
throw new SkipException("Test requires multi-region account for read barriers to be triggered.");
1833+
}
1834+
18291835
CosmosAsyncClient newClient = null;
18301836
String faultInjectionRuleId = "barrier-429-read-yield-" + UUID.randomUUID();
18311837
FaultInjectionRule barrierThrottleRule =
@@ -1900,6 +1906,10 @@ public void faultInjection_writeBarrierThrottled_returns408() throws JsonProcess
19001906
throw new SkipException("Test only applicable to STRONG consistency level.");
19011907
}
19021908

1909+
if (this.accountLevelReadRegions.size() <= 1) {
1910+
throw new SkipException("Test requires multi-region account for write barriers to be triggered.");
1911+
}
1912+
19031913
CosmosAsyncClient newClient = null;
19041914
String faultInjectionRuleId = "barrier-429-write-408-" + UUID.randomUUID();
19051915
FaultInjectionRule barrierThrottleRule =
@@ -1973,6 +1983,10 @@ public void faultInjection_readBarrierThrottled_thenRecovers() throws JsonProces
19731983
throw new SkipException("Test only applicable to STRONG consistency level.");
19741984
}
19751985

1986+
if (this.accountLevelReadRegions.size() <= 1) {
1987+
throw new SkipException("Test requires multi-region account for read barriers to be triggered.");
1988+
}
1989+
19761990
CosmosAsyncClient newClient = null;
19771991
String faultInjectionRuleId = "barrier-429-recover-" + UUID.randomUUID();
19781992
FaultInjectionRule barrierThrottleRule =

0 commit comments

Comments
 (0)