Skip to content

Commit 673340d

Browse files
authored
Disable SPN based tests in kafka connector (Azure#46638)
* Remove role assignment with a non-existent principal and temporarily skip SPN-based auth tests. * Update azure-cosmos-kafka-connect v2.5.1 release notes. * Update azure-cosmos-kafka-connect v2.5.1 release notes. * Specify tracked issue to re-enable SPN-based tests. * Specify tracked issue to re-enable SPN-based tests.
1 parent d041e13 commit 673340d

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

sdk/cosmos/azure-cosmos-kafka-connect/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66

77
#### Breaking Changes
88

9+
#### Bugs Fixed
10+
11+
#### Other Changes
12+
13+
### 2.5.1 (2025-08-22)
14+
915
#### Bugs Fixed
1016
* Fixed an issue where `CosmosSourceConnector` got stuck when restart - See [PR 46378](https://github.com/Azure/azure-sdk-for-java/pull/46378)
1117
* Fixed `BadRequestException` in `CosmosSourceConnector` when using `azure.cosmos.source.containers.includeAll=true` - See [PR 46389](https://github.com/Azure/azure-sdk-for-java/pull/46389)

sdk/cosmos/azure-cosmos-kafka-connect/src/test/java/com/azure/cosmos/kafka/connect/CosmosSinkConnectorITest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.slf4j.Logger;
2525
import org.slf4j.LoggerFactory;
2626
import org.sourcelab.kafka.connect.apiclient.request.dto.ConnectorStatus;
27+
import org.testng.SkipException;
2728
import org.testng.annotations.AfterClass;
2829
import org.testng.annotations.BeforeClass;
2930
import org.testng.annotations.DataProvider;
@@ -92,6 +93,7 @@ public void sinkToSingleContainer(boolean useMasterKey) throws InterruptedExcept
9293
sinkConnectorConfig.put("azure.cosmos.account.tenantId", KafkaCosmosTestConfigurations.ACCOUNT_TENANT_ID);
9394
sinkConnectorConfig.put("azure.cosmos.auth.aad.clientId", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_ID);
9495
sinkConnectorConfig.put("azure.cosmos.auth.aad.clientSecret", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_SECRET);
96+
throw new SkipException("ServicePrincipal-based auth has been disabled in the live tests for the time-being. See issue - https://github.com/Azure/azure-sdk-for-java/issues/46639");
9597
}
9698

9799
// Create topic ahead of time
@@ -172,6 +174,7 @@ public void createConnectorWithWrongContainerName(boolean useMasterKey) {
172174
sinkConnectorConfig.put("azure.cosmos.account.tenantId", KafkaCosmosTestConfigurations.ACCOUNT_TENANT_ID);
173175
sinkConnectorConfig.put("azure.cosmos.auth.aad.clientId", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_ID);
174176
sinkConnectorConfig.put("azure.cosmos.auth.aad.clientSecret", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_SECRET);
177+
throw new SkipException("ServicePrincipal-based auth has been disabled in the live tests for the time-being. See issue - https://github.com/Azure/azure-sdk-for-java/issues/46639");
175178
}
176179

177180
// Create topic ahead of time
@@ -227,6 +230,7 @@ public void createConnectorWithWrongDatabaseName(boolean useMasterKey) {
227230
sinkConnectorConfig.put("azure.cosmos.account.tenantId", KafkaCosmosTestConfigurations.ACCOUNT_TENANT_ID);
228231
sinkConnectorConfig.put("azure.cosmos.auth.aad.clientId", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_ID);
229232
sinkConnectorConfig.put("azure.cosmos.auth.aad.clientSecret", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_SECRET);
233+
throw new SkipException("ServicePrincipal-based auth has been disabled in the live tests for the time-being. See issue - https://github.com/Azure/azure-sdk-for-java/issues/46639");
230234
}
231235

232236
// Create topic ahead of time

sdk/cosmos/azure-cosmos-kafka-connect/src/test/java/com/azure/cosmos/kafka/connect/CosmosSourceConnectorITest.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.slf4j.Logger;
2727
import org.slf4j.LoggerFactory;
2828
import org.sourcelab.kafka.connect.apiclient.request.dto.ConnectorStatus;
29+
import org.testng.SkipException;
2930
import org.testng.annotations.AfterClass;
3031
import org.testng.annotations.BeforeClass;
3132
import org.testng.annotations.DataProvider;
@@ -148,6 +149,7 @@ public void readFromSingleContainer(boolean useMasterKey, CosmosMetadataStorageT
148149
sourceConnectorConfig.put("azure.cosmos.account.tenantId", KafkaCosmosTestConfigurations.ACCOUNT_TENANT_ID);
149150
sourceConnectorConfig.put("azure.cosmos.auth.aad.clientId", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_ID);
150151
sourceConnectorConfig.put("azure.cosmos.auth.aad.clientSecret", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_SECRET);
152+
throw new SkipException("ServicePrincipal-based auth has been disabled in the live tests for the time-being. See - https://github.com/Azure/azure-sdk-for-java/issues/46639");
151153
}
152154

153155
if (metadataStorageType == CosmosMetadataStorageType.COSMOS) {
@@ -350,6 +352,7 @@ public void createConnectorWithWrongDatabaseName(boolean useMasterKey, CosmosMet
350352
sourceConnectorConfig.put("azure.cosmos.account.tenantId", KafkaCosmosTestConfigurations.ACCOUNT_TENANT_ID);
351353
sourceConnectorConfig.put("azure.cosmos.auth.aad.clientId", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_ID);
352354
sourceConnectorConfig.put("azure.cosmos.auth.aad.clientSecret", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_SECRET);
355+
throw new SkipException("ServicePrincipal-based auth has been disabled in the live tests for the time-being. See - https://github.com/Azure/azure-sdk-for-java/issues/46639");
353356
}
354357

355358
if (metadataStorageType == CosmosMetadataStorageType.COSMOS) {
@@ -419,6 +422,7 @@ public void connectorStart_metadata_cosmosStorageType(
419422
sourceConnectorConfig.put("azure.cosmos.account.tenantId", KafkaCosmosTestConfigurations.ACCOUNT_TENANT_ID);
420423
sourceConnectorConfig.put("azure.cosmos.auth.aad.clientId", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_ID);
421424
sourceConnectorConfig.put("azure.cosmos.auth.aad.clientSecret", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_SECRET);
425+
throw new SkipException("ServicePrincipal-based auth has been disabled in the live tests for the time-being. See - https://github.com/Azure/azure-sdk-for-java/issues/46639");
422426
}
423427

424428
// Create topic ahead of time
@@ -502,6 +506,7 @@ public void readFromAllContainer(boolean useMasterKey, CosmosMetadataStorageType
502506
sourceConnectorConfig.put("azure.cosmos.account.tenantId", KafkaCosmosTestConfigurations.ACCOUNT_TENANT_ID);
503507
sourceConnectorConfig.put("azure.cosmos.auth.aad.clientId", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_ID);
504508
sourceConnectorConfig.put("azure.cosmos.auth.aad.clientSecret", KafkaCosmosTestConfigurations.ACCOUNT_AAD_CLIENT_SECRET);
509+
throw new SkipException("ServicePrincipal-based auth has been disabled in the live tests for the time-being. See - https://github.com/Azure/azure-sdk-for-java/issues/46639");
505510
}
506511

507512
if (metadataStorageType == CosmosMetadataStorageType.COSMOS) {
@@ -534,7 +539,7 @@ public void readFromAllContainer(boolean useMasterKey, CosmosMetadataStorageType
534539
// Create items in all containers
535540
logger.info("Creating items in multiple containers");
536541
Map<String, List<String>> createdItemsByContainer = new HashMap<>();
537-
542+
538543
// Create items in single partition container
539544
List<String> singleContainerItems = new ArrayList<>();
540545
for (int i = 0; i < 5; i++) {
@@ -581,7 +586,7 @@ public void readFromAllContainer(boolean useMasterKey, CosmosMetadataStorageType
581586

582587
Map<String, List<ConsumerRecord<String, JsonNode>>> recordsByTopic = new HashMap<>();
583588
List<ConsumerRecord<String, JsonNode>> metadataRecords = new ArrayList<>();
584-
589+
585590
// Calculate expected metadata records based on storage type and number of containers
586591
int expectedMetadataRecordsCount = metadataStorageType == CosmosMetadataStorageType.COSMOS ? 0 : 4; // 1 containers metadata + 3 feed ranges metadata
587592
int totalExpectedRecords = createdItemsByContainer.values().stream().mapToInt(List::size).sum();
@@ -597,11 +602,11 @@ public void readFromAllContainer(boolean useMasterKey, CosmosMetadataStorageType
597602
recordsByTopic.computeIfAbsent(topic, k -> new ArrayList<>()).add(consumerRecord);
598603
}
599604
});
600-
605+
601606
int currentTotalRecords = recordsByTopic.values().stream()
602607
.mapToInt(List::size)
603608
.sum();
604-
609+
605610
return metadataRecords.size() >= expectedMetadataRecordsCount &&
606611
currentTotalRecords >= totalExpectedRecords;
607612
});
@@ -618,7 +623,7 @@ public void readFromAllContainer(boolean useMasterKey, CosmosMetadataStorageType
618623
assertThat(rootJsonNode.get(UnifiedMetadataSchemaConstants.ENTITY_TYPE_NAME)).isNotNull();
619624
assertThat(rootJsonNode.get(UnifiedMetadataSchemaConstants.ENTITY_TYPE_NAME).textValue())
620625
.isEqualTo(MetadataEntityTypes.CONTAINERS_METADATA_V1);
621-
626+
622627
JsonNode jsonValueNode = rootJsonNode.get(UnifiedMetadataSchemaConstants.JSON_VALUE_NAME);
623628
assertThat(jsonValueNode).isNotNull();
624629
String jsonValue = jsonValueNode.textValue();

sdk/cosmos/test-resources/kafka-testcontainer/test-resources.json

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,6 @@
120120
"capabilities": [],
121121
"ipRules": []
122122
}
123-
},
124-
{
125-
"type": "Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments",
126-
"apiVersion": "[variables('apiVersion')]",
127-
"name": "[concat(variables('accountName'), '/',guid(parameters('baseName')))]",
128-
"dependsOn": [
129-
"[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('accountName'))]"
130-
],
131-
"properties": {
132-
"principalId": "[parameters('kafkaTestApplicationOid')]",
133-
"roleDefinitionId": "[variables('azureCosmosRoleId')]",
134-
"scope": "[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('accountName'))]"
135-
}
136123
}
137124
],
138125
"outputs": {

0 commit comments

Comments
 (0)