From ea8b4bf36539f5a220e7b3c1787953f071e65d62 Mon Sep 17 00:00:00 2001 From: "Fengrui Lu (WICRESOFT NORTH AMERICA LTD)" Date: Wed, 4 Aug 2021 15:44:47 +0800 Subject: [PATCH] Updates to enable live testing in sovereign clouds for multiple services --- sdk/eventhub/tests.yml | 8 ++++---- .../tests/test_copy_model.py | 8 +++++++- sdk/formrecognizer/test-resources.json | 6 +++--- sdk/formrecognizer/tests.yml | 7 +++++++ sdk/keyvault/tests.yml | 1 + sdk/servicebus/test-resources.json | 4 ++++ sdk/servicebus/tests.yml | 15 +++++++++++---- sdk/textanalytics/tests.yml | 1 + 8 files changed, 38 insertions(+), 12 deletions(-) diff --git a/sdk/eventhub/tests.yml b/sdk/eventhub/tests.yml index 024fa153ea3d7..7fe1615ffa92f 100644 --- a/sdk/eventhub/tests.yml +++ b/sdk/eventhub/tests.yml @@ -7,6 +7,7 @@ stages: ServiceDirectory: eventhub BuildTargetingString: azure-eventhub* DeployArmTemplate: true + SupportedClouds: 'Public,UsGov,China' MatrixReplace: - TestSamples=.*/true MatrixFilters: @@ -15,8 +16,7 @@ stages: AZURE_STORAGE_DATA_LAKE_ENABLED_CONN_STR: $(python-eh-livetest-event-hub-storage-data-lake-enabled-conn-str) IOTHUB_CONNECTION_STR: $(python-eh-livetest-event-hub-iothub-connection-str) IOTHUB_DEVICE: $(python-eh-livetest-event-hub-iothub-device) - AZURE_CLIENT_ID: $(python-eh-livetest-event-hub-aad-client-id) - AZURE_TENANT_ID: $(python-eh-livetest-event-hub-aad-tenant-id) - AZURE_CLIENT_SECRET: $(python-eh-livetest-event-hub-aad-secret) - AZURE_SUBSCRIPTION_ID: $(python-eh-livetest-event-hub-subscription-id) + AZURE_CLIENT_ID: $(EVENTHUB_CLIENT_ID) + AZURE_TENANT_ID: $(EVENTHUB_TENANT_ID) + AZURE_CLIENT_SECRET: $(EVENTHUB_CLIENT_SECRET) AZURE_COSMOS_CONN_STR: $(python-eventhub-livetest-cosmos-conn-str) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_copy_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_copy_model.py index 00306b664f9fe..1c9672bddbbf6 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_copy_model.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_copy_model.py @@ -274,7 +274,13 @@ def test_copy_model_fail_v21(self, client, formrecognizer_storage_container_sas_ model = poller.result() # give an incorrect region - target = client.get_copy_authorization(resource_region="eastus", resource_id=formrecognizer_resource_id) + print("formrecognizer_region value is {}".format(formrecognizer_region)) + if formrecognizer_region == 'usgovarizona': + resource_regionA = 'usgovvirginia' + else: + resource_regionA = 'usgovarizona' + print("resource_regionA value is {}".format(resource_regionA)) + target = client.get_copy_authorization(resource_region=resource_regionA, resource_id=formrecognizer_resource_id) with pytest.raises(HttpResponseError) as e: poller = client.begin_copy_model(model.model_id, target=target) diff --git a/sdk/formrecognizer/test-resources.json b/sdk/formrecognizer/test-resources.json index b6f4a41695f3b..91eb1ad31ee06 100644 --- a/sdk/formrecognizer/test-resources.json +++ b/sdk/formrecognizer/test-resources.json @@ -42,7 +42,7 @@ "description": "The application client secret used to run tests." } }, - "formRecognizerEndpointSuffix": { + "cognitiveServicesEndpointSuffix": { "defaultValue": ".cognitiveservices.azure.com/", "type": "String" }, @@ -56,7 +56,7 @@ }, "blobResourceId": { "type": "string", - "defaultValue": "[resourceId('2cd617ea-1866-46b1-90e3-fffb087ebf9b', 'TrainingData', 'Microsoft.Storage/storageAccounts', parameters('blobStorageAccount'))]" + "defaultValue": "[resourceId('TrainingData', 'Microsoft.Storage/storageAccounts', parameters('blobStorageAccount'))]" }, "trainingDataSasProperties": { "type": "object", @@ -204,7 +204,7 @@ "authorizationApiVersion": "2018-09-01-preview", "formRecognizerBaseName": "[concat('formrecognizer', parameters('baseName'))]", "formRecognizerApiVersion": "2017-04-18", - "azureFormRecognizerUrl": "[concat('https://', variables('formRecognizerBaseName'), parameters('formRecognizerEndpointSuffix'))]", + "azureFormRecognizerUrl": "[concat('https://', variables('formRecognizerBaseName'), parameters('cognitiveServicesEndpointSuffix'))]", "cognitiveServiceUserRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/a97b65f3-24c7-4388-baec-2e87135dc908')]" }, "resources": [ diff --git a/sdk/formrecognizer/tests.yml b/sdk/formrecognizer/tests.yml index 1687afdc48885..2bfc572f4ce5d 100644 --- a/sdk/formrecognizer/tests.yml +++ b/sdk/formrecognizer/tests.yml @@ -9,6 +9,7 @@ stages: TestTimeoutInMinutes: 200 MatrixReplace: - TestSamples=.*/true + SupportedClouds: 'Public,UsGov,China' Clouds: 'Prod,Canary' # This is a specific request from the formrecognizer service team # their claim is that the full matrix ends up stress-testing their service. @@ -23,6 +24,12 @@ stages: MatrixFilters: - OSVmImage=^(?!macOS).* - PythonVersion=^(?!pypy3).* + Public: + SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources) + UsGov: + SubscriptionConfiguration: $(sub-config-gov-test-resources) + China: + SubscriptionConfiguration: $(sub-config-cn-test-resources) EnvVars: AZURE_SUBSCRIPTION_ID: $(provisioner-subscription) AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) diff --git a/sdk/keyvault/tests.yml b/sdk/keyvault/tests.yml index 5c62f4d9eee5a..fc8832c9cc685 100644 --- a/sdk/keyvault/tests.yml +++ b/sdk/keyvault/tests.yml @@ -18,6 +18,7 @@ stages: DeployArmTemplate: true AllocateResourceGroup: true TestTimeoutInMinutes: 240 + SupportedClouds: 'Public,UsGov,China' ${{ if eq(service, 'azure-keyvault-keys') }}: AdditionalMatrixConfigs: - Name: keyvault_test_matrix_addons diff --git a/sdk/servicebus/test-resources.json b/sdk/servicebus/test-resources.json index e0025711becd3..5b1ff8c6c05a1 100644 --- a/sdk/servicebus/test-resources.json +++ b/sdk/servicebus/test-resources.json @@ -236,6 +236,10 @@ "SERVICE_BUS_SESSION_QUEUE_SAS_KEY":{ "type": "string", "value": "[listkeys(variables('sessionQueueAuthorizationRuleName'), variables('sbVersion')).primaryKey]" + }, + "RESOURCE_REGION": { + "type": "string", + "value": "[parameters('location')]" } } } \ No newline at end of file diff --git a/sdk/servicebus/tests.yml b/sdk/servicebus/tests.yml index e40693078864b..c42a3ba3fe6e7 100644 --- a/sdk/servicebus/tests.yml +++ b/sdk/servicebus/tests.yml @@ -6,14 +6,15 @@ stages: ServiceDirectory: servicebus TestTimeoutInMinutes: 300 DeployArmTemplate: true + SupportedClouds: 'Public,UsGov,China' MatrixReplace: - TestSamples=.*/true BuildTargetingString: azure-servicebus* EnvVars: - AZURE_SUBSCRIPTION_ID: $(azure-subscription-id) - AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) - AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) - AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) + AZURE_SUBSCRIPTION_ID: $(SERVICEBUS_SUBSCRIPTION_ID) + AZURE_TENANT_ID: $(SERVICEBUS_TENANT_ID) + AZURE_CLIENT_ID: $(SERVICEBUS_CLIENT_ID) + AZURE_CLIENT_SECRET: $(SERVICEBUS_CLIENT_SECRET) AZURE_TEST_RUN_LIVE: 'true' MatrixFilters: - PythonVersion=^(?!pypy3).* @@ -24,3 +25,9 @@ stages: Canary: SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources) Location: 'centraluseuap' + UsGov: + SubscriptionConfiguration: $(sub-config-gov-test-resources) + Location: 'usgovarizona' + China: + SubscriptionConfiguration: $(sub-config-cn-test-resources) + Location: 'chinaeast2' diff --git a/sdk/textanalytics/tests.yml b/sdk/textanalytics/tests.yml index b5ffb1e0e8a18..f643e01800037 100644 --- a/sdk/textanalytics/tests.yml +++ b/sdk/textanalytics/tests.yml @@ -8,6 +8,7 @@ stages: DeployArmTemplate: true MatrixReplace: - TestSamples=.*/true + SupportedClouds: 'Public,UsGov,China' EnvVars: AZURE_SUBSCRIPTION_ID: $(azure-subscription-id) AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)