diff --git a/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client.py index b9105b85d3d9..2f7ca34a9c7b 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client.py @@ -33,7 +33,7 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineRequest from azure.identity import AzureAuthorityHosts -from testcase import ContainerRegistryTestClass, get_authority, get_audience, is_public_endpoint +from testcase import ContainerRegistryTestClass, get_authority, get_audience, is_public_endpoint, is_china_endpoint from constants import HELLO_WORLD, DOES_NOT_EXIST from preparer import acr_preparer from devtools_testutils import recorded_by_proxy @@ -636,10 +636,8 @@ def test_upload_blob(self, containerregistry_endpoint): @acr_preparer() def upload_large_blob_in_chunk(self, **kwargs): containerregistry_endpoint = kwargs.pop("containerregistry_endpoint") - if not is_public_endpoint(containerregistry_endpoint): - pytest.skip( - "Running on non-public cloud may cause all tests finishing longer than the max time of 120 mins." - ) + if is_china_endpoint(containerregistry_endpoint): + pytest.skip("Running on China cloud usually will fail due to timeout.") repo = self.get_resource_name("repo") with self.create_registry_client(containerregistry_endpoint) as client: diff --git a/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client_async.py b/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client_async.py index 17615b9fdc32..5fdf26bece8a 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client_async.py +++ b/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client_async.py @@ -34,7 +34,7 @@ from azure.core.pipeline import PipelineRequest from azure.identity import AzureAuthorityHosts from asynctestcase import AsyncContainerRegistryTestClass, get_authority, get_audience -from testcase import is_public_endpoint +from testcase import is_public_endpoint, is_china_endpoint from constants import HELLO_WORLD, DOES_NOT_EXIST from preparer import acr_preparer from devtools_testutils.aio import recorded_by_proxy_async @@ -640,10 +640,8 @@ async def test_upload_blob(self, containerregistry_endpoint): @acr_preparer() async def test_upload_large_blob_in_chunk(self, **kwargs): containerregistry_endpoint = kwargs.pop("containerregistry_endpoint") - if not is_public_endpoint(containerregistry_endpoint): - pytest.skip( - "Running on non-public cloud may cause all tests finishing longer than the max time of 120 mins." - ) + if is_china_endpoint(containerregistry_endpoint): + pytest.skip("Running on China cloud usually will fail due to timeout.") repo = self.get_resource_name("repo") async with self.create_registry_client(containerregistry_endpoint) as client: diff --git a/sdk/containerregistry/azure-containerregistry/tests/testcase.py b/sdk/containerregistry/azure-containerregistry/tests/testcase.py index 6b3073df375a..055dd8cddd25 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/testcase.py +++ b/sdk/containerregistry/azure-containerregistry/tests/testcase.py @@ -86,6 +86,10 @@ def is_public_endpoint(endpoint): return ".azurecr.io" in endpoint +def is_china_endpoint(endpoint): + return ".azurecr.cn" in endpoint + + def get_authority(endpoint: str) -> str: if ".azurecr.io" in endpoint: logger.warning("Public cloud Authority") diff --git a/sdk/containerregistry/tests.yml b/sdk/containerregistry/tests.yml index 2fedee9b8fa4..3e2dd3ee429a 100644 --- a/sdk/containerregistry/tests.yml +++ b/sdk/containerregistry/tests.yml @@ -6,6 +6,7 @@ stages: BuildTargetingString: azure-containerregistry ServiceDirectory: containerregistry SupportedClouds: 'Public,UsGov,China' + TestTimeoutInMinutes: 240 CloudConfig: Public: SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)