Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
c880fbf
Add more verbose asserts
FabianMeiswinkel Jun 25, 2026
a60a7c0
Potential fix for pull request finding
FabianMeiswinkel Jun 26, 2026
e9c3e35
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jun 26, 2026
157a4ad
Potential fix for pull request finding
FabianMeiswinkel Jun 26, 2026
3d34939
Fix NITs in tests
FabianMeiswinkel Jun 26, 2026
431ea68
Update PerPartitionCircuitBreakerE2ETests.java
FabianMeiswinkel Jun 26, 2026
8849c5a
Update ReadFeedStoredProceduresTest.java
FabianMeiswinkel Jun 26, 2026
19f800a
Update CosmosItemTest.java
FabianMeiswinkel Jun 26, 2026
1e5d841
Update StoredProcedureUpsertReplaceTest.java
FabianMeiswinkel Jun 26, 2026
6dabaae
Update FaultInjectionServerErrorRuleOnDirectTests.java
FabianMeiswinkel Jun 26, 2026
bff6574
Update FaultInjectionServerErrorRuleOnDirectTests.java
FabianMeiswinkel Jun 26, 2026
9ec325c
Update StoredProcedureQueryTest.java
FabianMeiswinkel Jun 26, 2026
42db971
Fix SP tests
FabianMeiswinkel Jun 26, 2026
525e1d4
More SP test fixes
FabianMeiswinkel Jun 26, 2026
e2037e5
Update CosmosContainerChangeFeedTest.java
FabianMeiswinkel Jun 26, 2026
2368d58
Fix test flakiness
FabianMeiswinkel Jun 26, 2026
0fa3305
Update CosmosSyncStoredProcTest.java
FabianMeiswinkel Jun 26, 2026
749a395
Fix test flakiness
FabianMeiswinkel Jun 26, 2026
b309f37
Update TestSuiteBase.java
FabianMeiswinkel Jun 26, 2026
b4aeb52
Changing test regions
FabianMeiswinkel Jun 26, 2026
97b4bb4
Update TestSuiteBase.java
FabianMeiswinkel Jun 26, 2026
3e44374
Update CosmosDiagnosticsTest.java
FabianMeiswinkel Jun 26, 2026
6fa7874
Update KafkaCosmosConnectContainer.java
FabianMeiswinkel Jun 26, 2026
8136a76
Fix test issues
FabianMeiswinkel Jun 27, 2026
b77fcc3
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jun 27, 2026
6fd160c
Update TestSuiteBase.java
FabianMeiswinkel Jun 29, 2026
f22b10e
Update ClientMetricsTest.java
FabianMeiswinkel Jun 29, 2026
6fd13bf
Update ClientMetricsTest.java
FabianMeiswinkel Jun 29, 2026
1c02d51
Update EndToEndTimeOutValidationTests.java
FabianMeiswinkel Jun 29, 2026
3dbb741
Update CosmosItemTest.java
FabianMeiswinkel Jun 29, 2026
eea3402
Fix test flakiness
FabianMeiswinkel Jun 29, 2026
44d52be
Address flakiness
FabianMeiswinkel Jun 29, 2026
e756565
Systemically fixing container creation race
FabianMeiswinkel Jun 29, 2026
4603395
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jun 29, 2026
dccadef
Update TestSuiteBase.java
FabianMeiswinkel Jun 29, 2026
fa7790d
Update TransactionalBatchAsyncContainerTest.java
FabianMeiswinkel Jun 29, 2026
d7c2457
Update EndToEndTimeOutValidationTests.java
FabianMeiswinkel Jun 29, 2026
da1ead6
Update EndToEndTimeOutValidationTests.java
FabianMeiswinkel Jun 29, 2026
89e2c15
Update EndToEndTimeOutValidationTests.java
FabianMeiswinkel Jun 29, 2026
e8110f9
Update CosmosItemTest.java
FabianMeiswinkel Jun 29, 2026
230ee23
Update CosmosBulkTest.java
FabianMeiswinkel Jun 29, 2026
102085c
Update AzureKeyCredentialTest.java
FabianMeiswinkel Jun 29, 2026
5807563
Update CosmosContainerOpenConnectionsAndInitCachesTest.java
FabianMeiswinkel Jun 29, 2026
f7e565a
Update OperationPoliciesTest.java
FabianMeiswinkel Jun 29, 2026
15a9e2e
Update ProactiveConnectionManagementTest.java
FabianMeiswinkel Jun 29, 2026
87ca96e
Fixed flaky tests
FabianMeiswinkel Jun 29, 2026
68ea1f9
Update CosmosItemContentResponseOnWriteTest.java
FabianMeiswinkel Jun 29, 2026
f40486a
Make getFeedRanges from tests more robust
FabianMeiswinkel Jun 29, 2026
22fe6ca
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jun 29, 2026
7c10d3b
Update GatewayAddressCacheTest.java
FabianMeiswinkel Jun 29, 2026
373be1a
Merge branch 'users/fabianm/Testfix' of https://github.com/FabianMeis…
FabianMeiswinkel Jun 29, 2026
e5cfbc5
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jun 29, 2026
056e266
Update CustomerWorkflowPartitionLevelCircuitBreakerTest.java
FabianMeiswinkel Jun 29, 2026
c337e8c
Merge branch 'users/fabianm/Testfix' of https://github.com/FabianMeis…
FabianMeiswinkel Jun 29, 2026
8a5e8a8
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jun 29, 2026
df536b4
Merge branch 'users/fabianm/Testfix' of https://github.com/FabianMeis…
FabianMeiswinkel Jun 29, 2026
67df9b9
Fix Test flakiness
FabianMeiswinkel Jun 29, 2026
6e5ebf3
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jun 29, 2026
26abb95
Update CosmosItemTest.java
FabianMeiswinkel Jun 30, 2026
3e19fbf
Increasing setup timeouts
FabianMeiswinkel Jun 30, 2026
9acafbc
More robustness imprvements
FabianMeiswinkel Jun 30, 2026
2ec1944
More robustness fixes
FabianMeiswinkel Jun 30, 2026
7047653
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jun 30, 2026
696318a
Update LocationCacheTest.java
FabianMeiswinkel Jun 30, 2026
9c5d1d7
Update FaultInjectionWithAvailabilityStrategyTestsBase.java
FabianMeiswinkel Jun 30, 2026
63086c6
Update TestSuiteBase.java
FabianMeiswinkel Jun 30, 2026
5cbec09
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jun 30, 2026
7678abf
Fix FI unit tests
FabianMeiswinkel Jun 30, 2026
b2c2334
Fixing test flakiness
FabianMeiswinkel Jul 1, 2026
ea9cd34
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jul 1, 2026
235f597
Update TestSuiteBase.java
FabianMeiswinkel Jul 1, 2026
71fa847
fix bulk test failures
FabianMeiswinkel Jul 1, 2026
4069dfa
Update FaultInjectionWithAvailabilityStrategyTestsBase.java
FabianMeiswinkel Jul 1, 2026
3aa3840
Update TestSuiteBase.java
FabianMeiswinkel Jul 1, 2026
c4724bf
Update OperationPoliciesTest.java
FabianMeiswinkel Jul 1, 2026
dadc344
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jul 1, 2026
7d31bf4
Fixes ReadManyByPK bug in Spark connector resulting in duplicates and…
FabianMeiswinkel Jul 1, 2026
22d755a
Updating changelogs
FabianMeiswinkel Jul 1, 2026
83ad534
Update CosmosReadManyByPartitionKeyReader.scala
FabianMeiswinkel Jul 1, 2026
70bd3a1
Reacting to code review feedback
FabianMeiswinkel Jul 2, 2026
22c0cdc
Fixing remaining test failures
FabianMeiswinkel Jul 2, 2026
fb7344d
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jul 2, 2026
ce20908
Fixing remaining test flakiness
FabianMeiswinkel Jul 2, 2026
402682d
Update ClientMetricsTest.java
FabianMeiswinkel Jul 6, 2026
5bb417d
Update FaultInjectionServerErrorRuleOnDirectTests.java
FabianMeiswinkel Jul 6, 2026
bab9f80
Update ChangeFeedTest.java
FabianMeiswinkel Jul 6, 2026
373076e
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
FabianMeiswinkel Jul 6, 2026
0f04410
Merge branch 'main' into users/fabianm/Testfix
FabianMeiswinkel Jul 6, 2026
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 @@ -81,7 +81,7 @@ public ClientMetricsTest(CosmosClientBuilder clientBuilder) {
super(clientBuilder);
}

@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void maxValueExceedingDefinedLimitStillWorksWithoutException() throws Exception {

// Expected behavior is that higher values than the expected max value can still be recorded
Expand Down Expand Up @@ -129,7 +129,7 @@ public void maxValueExceedingDefinedLimitStillWorksWithoutException() throws Exc
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void createItem() throws Exception {
boolean[] disableLatencyMeterTestCases = { false, true };

Expand Down Expand Up @@ -200,7 +200,7 @@ public void createItem() throws Exception {
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void createItemWithAllMetrics() throws Exception {

boolean[] suppressConsistencyLevelTagTestCases = { false, true };
Expand Down Expand Up @@ -273,7 +273,7 @@ public void createItemWithAllMetrics() throws Exception {
// Increased timeout from TIMEOUT to SETUP_TIMEOUT to account for collection creation time
// during TestState initialization, especially in CI environments where collection creation
// can take longer than 40 seconds
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void readItem() throws Exception {
try (TestState state = new TestState(getClientBuilder(), CosmosMetricCategory.DEFAULT)) {
InternalObjectNode properties = getDocumentDefinition(UUID.randomUUID().toString());
Expand Down Expand Up @@ -306,7 +306,7 @@ public void readItem() throws Exception {
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void readNonExistingItem() throws Exception {
try (TestState state = new TestState(getClientBuilder(), CosmosMetricCategory.DEFAULT)) {

Expand Down Expand Up @@ -454,7 +454,7 @@ private void runReadItemTestWithThresholds(
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void readItemWithThresholdsApplied() throws Exception {
CosmosDiagnosticsThresholds maxThresholds = new CosmosDiagnosticsThresholds()
.setPointOperationLatencyThreshold(Duration.ofDays(1));
Expand Down Expand Up @@ -502,7 +502,7 @@ public void replaceItem() throws Exception {
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void deleteItem() throws Exception {
try (TestState state = new TestState(getClientBuilder(), CosmosMetricCategory.DEFAULT)) {
InternalObjectNode properties = getDocumentDefinition(UUID.randomUUID().toString());
Expand Down Expand Up @@ -531,7 +531,7 @@ public void deleteItem() throws Exception {
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void readAllItems() throws Exception {
try (TestState state = new TestState(getClientBuilder(), CosmosMetricCategory.DEFAULT)) {
InternalObjectNode properties = getDocumentDefinition(UUID.randomUUID().toString());
Expand Down Expand Up @@ -579,7 +579,7 @@ public void readAllItems() throws Exception {
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void readAllItemsWithDetailMetrics() throws Exception {
try (TestState state = new TestState(getClientBuilder(), CosmosMetricCategory.DEFAULT,
CosmosMetricCategory.OPERATION_DETAILS,
Expand Down Expand Up @@ -741,7 +741,7 @@ public void readAllItemsWithDetailMetricsWithExplicitPageSize() throws Exception
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void queryItems() throws Exception {
try (TestState state = new TestState(getClientBuilder(), CosmosMetricCategory.ALL)) {
InternalObjectNode properties = getDocumentDefinition(UUID.randomUUID().toString());
Expand Down Expand Up @@ -858,7 +858,10 @@ public void itemPatchSuccess() throws Exception {
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT)
// Increased timeout from TIMEOUT to SETUP_TIMEOUT to account for collection creation time
// (TestState provisions a fresh container; on multi-region accounts that create + readiness
// warm-up can consume most of the 40s budget before the bulk operation under test runs).
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void createItem_withBulk() throws Exception {
try (TestState state = new TestState(getClientBuilder(), CosmosMetricCategory.DEFAULT)) {
int totalRequest = 5;
Expand Down Expand Up @@ -937,7 +940,7 @@ public void createItem_withBulk() throws Exception {
}
}

@Test(groups = {"fast"}, timeOut = TIMEOUT)
@Test(groups = {"fast"}, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void batchMultipleItemExecution() throws Exception {
try (TestState state = new TestState(getClientBuilder(), CosmosMetricCategory.DEFAULT)){
TestDoc firstDoc = this.populateTestDoc(this.partitionKey1);
Expand Down Expand Up @@ -996,7 +999,7 @@ public void batchMultipleItemExecution() throws Exception {
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT * 2)
@Test(groups = { "fast" }, timeOut = TIMEOUT * 2, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void effectiveMetricCategoriesForDefault() throws Exception {
try (TestState state = new TestState(getClientBuilder(), CosmosMetricCategory.fromString("DeFAult"))) {
assertThat(state.getEffectiveMetricCategories().size()).isEqualTo(5);
Expand All @@ -1018,7 +1021,7 @@ public void effectiveMetricCategoriesForDefault() throws Exception {
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void effectiveMetricCategoriesForDefaultPlusDetails() throws Exception {
try (TestState state = new TestState(getClientBuilder(),
CosmosMetricCategory.DEFAULT,
Expand All @@ -1045,7 +1048,7 @@ public void effectiveMetricCategoriesForDefaultPlusDetails() throws Exception {
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void effectiveMetricCategoriesInvalidCategory() throws Exception {
String badCategoryName = "InvalidCategory";
try (TestState state = new TestState(getClientBuilder(),
Expand All @@ -1058,7 +1061,7 @@ public void effectiveMetricCategoriesInvalidCategory() throws Exception {
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT)
@Test(groups = { "fast" }, timeOut = SETUP_TIMEOUT, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void effectiveMetricCategoriesForAll() throws Exception {
try (TestState state = new TestState(getClientBuilder(), CosmosMetricCategory.ALL)) {

Expand Down Expand Up @@ -1114,7 +1117,7 @@ public void endpointMetricsAreDurable() throws Exception {
}
}

@Test(groups = { "fast" }, timeOut = TIMEOUT * 2)
@Test(groups = { "fast" }, timeOut = TIMEOUT * 2, retryAnalyzer = FlakyTestRetryAnalyzer.class)
public void effectiveMetricCategoriesForAllLatebound() throws Exception {
try (TestState state = new TestState(getClientBuilder(), CosmosMetricCategory.DEFAULT)) {
EnumSet<MetricCategory> effectiveMetricCategories =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,14 @@ public void faultInjectionServerErrorRuleTests_ServerConnectionTimeout() throws
// Due to the replica validation, there could be an extra open connection call flow, while the rule will also be applied on.
assertThat(serverConnectionDelayRule.getHitCount()).isBetween(1l, 2l);
assertThat(itemResponse.getDiagnostics()).isNotNull();
this.validateFaultInjectionRuleApplied(
itemResponse.getDiagnostics(),
OperationType.Create,
HttpConstants.StatusCodes.GONE,
HttpConstants.SubStatusCodes.TRANSPORT_GENERATED_410,
ruleId,
true
);

} finally {
serverConnectionDelayRule.disable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,23 +514,33 @@ public Document updateDocument(AsyncDocumentClient client, Document originalDocu
}

public List<Document> bulkInsert(AsyncDocumentClient client, List<Document> docs) {
ArrayList<Mono<ResourceResponse<Document>>> result = new ArrayList<Mono<ResourceResponse<Document>>>();
ArrayList<Mono<Document>> result = new ArrayList<Mono<Document>>();
String collectionLink = "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId();
for (int i = 0; i < docs.size(); i++) {
Document doc = docs.get(i);
result.add(client
.createDocument(
"dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(),
docs.get(i),
collectionLink,
doc,
null,
false)
.retryWhen(Retry.fixedDelay(SETUP_CREATE_RETRY_ATTEMPTS, SETUP_CREATE_RETRY_DELAY)
.filter(ChangeFeedTest::isTransientSetupCreateFailure)
.onRetryExhaustedThrow((retryBackoffSpec, retrySignal) -> retrySignal.failure())));
.onRetryExhaustedThrow((retryBackoffSpec, retrySignal) -> retrySignal.failure()))
.map(ResourceResponse::getResource)
// A retried create is non-idempotent: when a create times out (e.g. 408) the initial attempt
// may still have succeeded on the backend, so a subsequent retry fails with 409 Conflict.
// Treat that as success by returning the document we tried to create (ids are unique per
// document, so a 409 here can only mean the prior attempt already landed).
.onErrorResume(
ChangeFeedTest::isConflictSetupCreateFailure,
error -> Mono.just(doc)));
}

return Flux.merge(
Flux.fromIterable(result),
100)
.map(ResourceResponse::getResource).collectList().block();
.collectList().block();
}

@AfterMethod(groups = { "query", "emulator" }, timeOut = SETUP_TIMEOUT)
Expand Down Expand Up @@ -615,6 +625,12 @@ private static boolean isTransientSetupCreateFailure(Throwable error) {
return statusCode == 408 || statusCode == 429 || statusCode == 500 || statusCode == 503;
}

private static boolean isConflictSetupCreateFailure(Throwable error) {
Throwable unwrapped = reactor.core.Exceptions.unwrap(error);
return unwrapped instanceof com.azure.cosmos.CosmosException
&& ((com.azure.cosmos.CosmosException) unwrapped).getStatusCode() == 409;
}

private static void waitAtleastASecond(Instant befTime) throws InterruptedException {
while (befTime.plusSeconds(1).isAfter(Instant.now())) {
Thread.sleep(100);
Expand Down
Loading