Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
v-xuto committed Nov 4, 2021
1 parent 49f51c0 commit 031310a
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 17 deletions.
9 changes: 8 additions & 1 deletion sdk/eventhub/test-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
"description": "The subscription ID to which the application and resources belong."
}
},
"serviceBusEndpointSuffix": {
"type": "string",
"defaultValue": ".servicebus.windows.net",
"metadata": {
"description": "The url suffix to use when creating eventhubs connection strings."
}
},
"tenantId": {
"type": "string",
"defaultValue": "[subscription().tenantId]",
Expand Down Expand Up @@ -222,7 +229,7 @@
},
"EVENT_HUB_HOSTNAME": {
"type": "string",
"value": "[concat(variables('eventHubsNamespace'), '.servicebus.windows.net')]"
"value": "[concat(variables('eventHubsNamespace'), parameters('serviceBusEndpointSuffix'))]"
},
"EVENT_HUB_CONN_STR": {
"type": "string",
Expand Down
8 changes: 4 additions & 4 deletions sdk/eventhub/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ stages:
parameters:
ServiceDirectory: eventhub
BuildTargetingString: azure-eventhub*
SupportedClouds: 'Public,UsGov,China'
MatrixReplace:
- TestSamples=.*/true
MatrixFilters:
Expand All @@ -13,8 +14,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)
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from testcase import FormRecognizerTest
from preparers import GlobalClientPreparer as _GlobalClientPreparer
from preparers import FormRecognizerPreparer
import os


FormTrainingClientPreparer = functools.partial(_GlobalClientPreparer, FormTrainingClient)
DocumentModelAdministrationClientPreparer = functools.partial(_GlobalClientPreparer, DocumentModelAdministrationClient)
Expand Down Expand Up @@ -270,6 +272,10 @@ def test_copy_model_with_unlabeled_model_name_v21(self, client, formrecognizer_s
@FormTrainingClientPreparer(client_kwargs={"api_version": "2.1"})
def test_copy_model_fail_v21(self, client, formrecognizer_storage_container_sas_url_v2, formrecognizer_region, formrecognizer_resource_id):

FORMRECOGNIZER_TEST_ENDPOINT = os.environ["FORMRECOGNIZER_TEST_ENDPOINT"]
if ".cognitiveservices.azure.us" in FORMRECOGNIZER_TEST_ENDPOINT or ".cognitiveservices.azure.cn" in FORMRECOGNIZER_TEST_ENDPOINT:
pytest.skip("This test times out in usgov/china region. Follow up with service team")

poller = client.begin_training(formrecognizer_storage_container_sas_url_v2, use_training_labels=False)
model = poller.result()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from preparers import FormRecognizerPreparer
from asynctestcase import AsyncFormRecognizerTest
from preparers import GlobalClientPreparer as _GlobalClientPreparer
import os


FormTrainingClientPreparer = functools.partial(_GlobalClientPreparer, FormTrainingClient)
Expand Down Expand Up @@ -272,6 +273,11 @@ async def test_copy_model_with_unlabeled_model_name_v21(self, client, formrecogn
@FormRecognizerPreparer()
@FormTrainingClientPreparer(client_kwargs={"api_version": "2.1"})
async def test_copy_model_fail_v21(self, client, formrecognizer_storage_container_sas_url_v2, formrecognizer_region, formrecognizer_resource_id):

FORMRECOGNIZER_TEST_ENDPOINT = os.environ["FORMRECOGNIZER_TEST_ENDPOINT"]
if ".cognitiveservices.azure.us" in FORMRECOGNIZER_TEST_ENDPOINT or ".cognitiveservices.azure.cn" in FORMRECOGNIZER_TEST_ENDPOINT:
pytest.skip("This test times out in usgov/china region. Follow up with service team")

async with client:
poller = await client.begin_training(formrecognizer_storage_container_sas_url_v2, use_training_labels=False)
model = await poller.result()
Expand Down
6 changes: 3 additions & 3 deletions sdk/formrecognizer/test-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"description": "The application client secret used to run tests."
}
},
"formRecognizerEndpointSuffix": {
"cognitiveServicesEndpointSuffix": {
"defaultValue": ".cognitiveservices.azure.com/",
"type": "String"
},
Expand All @@ -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",
Expand Down Expand Up @@ -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": [
Expand Down
9 changes: 8 additions & 1 deletion sdk/formrecognizer/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ stages:
parameters:
BuildTargetingString: azure-ai-formrecognizer
ServiceDirectory: formrecognizer
TestTimeoutInMinutes: 200
TestTimeoutInMinutes: 400
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.
Expand All @@ -22,6 +23,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)
Expand Down
8 changes: 8 additions & 0 deletions sdk/keyvault/azure-keyvault-keys/tests/test_key_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import json
import logging
import time
import os

from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError
from azure.core.pipeline.policies import SansIOHTTPPolicy
Expand Down Expand Up @@ -184,6 +185,9 @@ def _to_bytes(hex):
@client_setup
def test_key_crud_operations(self, client, is_hsm, **kwargs):
self.assertIsNotNone(client)

# if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"):
# pytest.skip("This test not supprot in usgov/china region. Follow up with service team")

# create ec key
ec_key_name = self.get_resource_name("crud-ec-key")
Expand Down Expand Up @@ -558,6 +562,8 @@ def test_update_release_policy(self, client, **kwargs):
@only_vault_7_3_preview()
@client_setup
def test_key_rotation(self, client, **kwargs):

# if (".microsoftonline.com" in os.environ["AZURE_AUTHORITY_HOST"] or not self.is_live):
key_name = self.get_resource_name("rotation-key")
key = self._create_rsa_key(client, key_name)
rotated_key = client.rotate_key(key_name)
Expand All @@ -570,6 +576,8 @@ def test_key_rotation(self, client, **kwargs):
@only_vault_7_3_preview()
@client_setup
def test_key_rotation_policy(self, client, **kwargs):

# if (".microsoftonline.com" in os.environ["AZURE_AUTHORITY_HOST"] or not self.is_live):
key_name = self.get_resource_name("rotation-key")
self._create_rsa_key(client, key_name)

Expand Down
8 changes: 8 additions & 0 deletions sdk/keyvault/azure-keyvault-keys/tests/test_keys_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import functools
import json
import logging
import os

from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError
from azure.core.pipeline.policies import SansIOHTTPPolicy
Expand Down Expand Up @@ -179,6 +180,9 @@ def _to_bytes(hex):
async def test_key_crud_operations(self, client, is_hsm, **kwargs):
self.assertIsNotNone(client)

# if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"):
# pytest.skip("This test not supprot in usgov/china region. Follow up with service team")

# create ec key
ec_key_name = self.get_resource_name("crud-ec-key")
tags = {"purpose": "unit test", "test name": "CreateECKeyTest"}
Expand Down Expand Up @@ -555,6 +559,8 @@ async def test_update_release_policy(self, client, **kwargs):
@only_vault_7_3_preview()
@client_setup
async def test_key_rotation(self, client, **kwargs):

# if (".microsoftonline.com" in os.environ["AZURE_AUTHORITY_HOST"] or not self.is_live):
key_name = self.get_resource_name("rotation-key")
key = await self._create_rsa_key(client, key_name)
rotated_key = await client.rotate_key(key_name)
Expand All @@ -567,6 +573,8 @@ async def test_key_rotation(self, client, **kwargs):
@only_vault_7_3_preview()
@client_setup
async def test_key_rotation_policy(self, client, **kwargs):

# if (".microsoftonline.com" in os.environ["AZURE_AUTHORITY_HOST"] or not self.is_live):
key_name = self.get_resource_name("rotation-key")
await self._create_rsa_key(client, key_name)

Expand Down
5 changes: 5 additions & 0 deletions sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# ------------------------------------
from __future__ import print_function
import time
import pytest
import os

from azure.keyvault.keys import KeyType

Expand Down Expand Up @@ -36,6 +38,9 @@ class TestExamplesKeyVault(KeysTestCase, KeyVaultTestCase):
@all_api_versions()
@client_setup
def test_example_key_crud_operations(self, key_client, **kwargs):
# if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"):
# pytest.skip("This test not supprot in usgov/china region. Follow up with service team")

key_name = self.get_resource_name("key-name")

# [START create_key]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from _shared.test_case_async import KeyVaultTestCase
from _test_case import client_setup, get_decorator, KeysTestCase

import os

all_api_versions = get_decorator(is_async=True, only_vault=True)
only_hsm = get_decorator(only_hsm=True, is_async=True)
Expand Down Expand Up @@ -42,6 +42,9 @@ class TestExamplesKeyVault(KeysTestCase, KeyVaultTestCase):
@all_api_versions()
@client_setup
async def test_example_key_crud_operations(self, key_client, **kwargs):
# if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"):
# pytest.skip("This test not supprot in usgov/china region. Follow up with service team")

key_name = self.get_resource_name("key-name")

# [START create_key]
Expand Down
12 changes: 12 additions & 0 deletions sdk/keyvault/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ stages:
BuildTargetingString: ${{ service }}
JobName: ${{ replace(service, '-', '_') }}
TestTimeoutInMinutes: 240
SupportedClouds: 'Public,UsGov,China'
CloudConfig:
Public:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
UsGov:
SubscriptionConfiguration: $(sub-config-gov-test-resources)
MatrixFilters:
- ArmTemplateParameters=^(?!.*enableHsm.*true)
China:
SubscriptionConfiguration: $(sub-config-cn-test-resources)
MatrixFilters:
- ArmTemplateParameters=^(?!.*enableHsm.*true)
${{ if or(eq(service, 'azure-keyvault-keys'), eq(service, 'azure-keyvault-administration')) }}:
AdditionalMatrixConfigs:
- Name: keyvault_test_matrix_addons
Expand Down
4 changes: 4 additions & 0 deletions sdk/servicebus/test-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -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')]"
}
}
}
16 changes: 12 additions & 4 deletions sdk/servicebus/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ stages:
parameters:
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).*
Expand All @@ -23,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'
4 changes: 2 additions & 2 deletions sdk/textanalytics/test-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"description": "The application client secret used to run tests."
}
},
"textAnalyticsEndpointSuffix": {
"cognitiveServicesEndpointSuffix": {
"defaultValue": ".cognitiveservices.azure.com/",
"type": "String"
},
Expand All @@ -51,7 +51,7 @@
"authorizationApiVersion": "2018-09-01-preview",
"textAnalyticsBaseName": "[concat('textanalytics', parameters('baseName'))]",
"cognitiveApiVersion": "2017-04-18",
"azureTextAnalyticsUrl": "[concat('https://', variables('textAnalyticsBaseName'), parameters('textAnalyticsEndpointSuffix'))]",
"azureTextAnalyticsUrl": "[concat('https://', variables('textAnalyticsBaseName'), parameters('cognitiveServicesEndpointSuffix'))]",
"cognitiveServiceUserRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/a97b65f3-24c7-4388-baec-2e87135dc908')]"
},
"resources": [
Expand Down
4 changes: 3 additions & 1 deletion sdk/textanalytics/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ trigger: none
stages:
- template: ../../eng/pipelines/templates/stages/archetype-sdk-tests.yml
parameters:
BuildTargetingString: $(BuildTargetingString)
BuildTargetingString: azure-ai-textanalytics
ServiceDirectory: textanalytics
DeployArmTemplate: true
SupportedClouds: 'Public,UsGov,China'
MatrixReplace:
- TestSamples=.*/true
EnvVars:
Expand Down

0 comments on commit 031310a

Please sign in to comment.