From 2344a6382b89fdd49c2a07e13b8e1425675e1e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?McCoy=20Pati=C3=B1o?= <39780829+mccoyp@users.noreply.github.com> Date: Wed, 5 Jan 2022 17:25:13 -0800 Subject: [PATCH] [Key Vault] Skip tests failing with SAS issues (#22351) --- .../tests/test_backup_client.py | 7 +++++++ .../tests/test_backup_client_async.py | 7 +++++++ .../tests/test_examples_administration.py | 8 ++++++++ .../tests/test_examples_administration_async.py | 8 ++++++++ 4 files changed, 30 insertions(+) diff --git a/sdk/keyvault/azure-keyvault-administration/tests/test_backup_client.py b/sdk/keyvault/azure-keyvault-administration/tests/test_backup_client.py index 507d844cc0d2..cc9f32182d83 100644 --- a/sdk/keyvault/azure-keyvault-administration/tests/test_backup_client.py +++ b/sdk/keyvault/azure-keyvault-administration/tests/test_backup_client.py @@ -23,6 +23,9 @@ def __init__(self, *args, **kwargs): @all_api_versions() @backup_client_setup def test_full_backup_and_restore(self, client): + if self.is_live: + pytest.skip("SAS token failures are causing sev2 alerts for service team") + # backup the vault backup_poller = client.begin_backup(self.container_uri, self.sas_token) backup_operation = backup_poller.result() @@ -67,6 +70,9 @@ def test_full_backup_and_restore_rehydration(self, client): @all_api_versions() @backup_client_setup def test_selective_key_restore(self, client): + if self.is_live: + pytest.skip("SAS token failures are causing sev2 alerts for service team") + # create a key to selectively restore key_client = self.create_key_client(self.managed_hsm_url) key_name = self.get_resource_name("selective-restore-test-key") @@ -116,6 +122,7 @@ def test_backup_client_polling(self, client): # rehydrate a poller with a continuation token of a completed operation late_rehydrated = client.begin_backup(self.container_uri, self.sas_token, continuation_token=token) assert late_rehydrated.status() == "Succeeded" + late_rehydrated.wait() # restore the backup restore_poller = client.begin_restore(backup_operation.folder_url, self.sas_token) diff --git a/sdk/keyvault/azure-keyvault-administration/tests/test_backup_client_async.py b/sdk/keyvault/azure-keyvault-administration/tests/test_backup_client_async.py index 6c88271f9d50..92d5b641d4f0 100644 --- a/sdk/keyvault/azure-keyvault-administration/tests/test_backup_client_async.py +++ b/sdk/keyvault/azure-keyvault-administration/tests/test_backup_client_async.py @@ -21,6 +21,9 @@ def __init__(self, *args, **kwargs): @all_api_versions() @backup_client_setup async def test_full_backup_and_restore(self, client): + if self.is_live: + pytest.skip("SAS token failures are causing sev2 alerts for service team") + # backup the vault backup_poller = await client.begin_backup(self.container_uri, self.sas_token) backup_operation = await backup_poller.result() @@ -65,6 +68,9 @@ async def test_full_backup_and_restore_rehydration(self, client): @all_api_versions() @backup_client_setup async def test_selective_key_restore(self, client): + if self.is_live: + pytest.skip("SAS token failures are causing sev2 alerts for service team") + # create a key to selectively restore key_client = self.create_key_client(self.managed_hsm_url, is_async=True) key_name = self.get_resource_name("selective-restore-test-key") @@ -112,6 +118,7 @@ async def test_backup_client_polling(self, client): # rehydrate a poller with a continuation token of a completed operation late_rehydrated = await client.begin_backup(self.container_uri, self.sas_token, continuation_token=token) assert late_rehydrated.status() == "Succeeded" + await late_rehydrated.wait() # restore the backup restore_poller = await client.begin_restore(backup_operation.folder_url, self.sas_token) diff --git a/sdk/keyvault/azure-keyvault-administration/tests/test_examples_administration.py b/sdk/keyvault/azure-keyvault-administration/tests/test_examples_administration.py index e54853bfe55f..7c4706e40879 100644 --- a/sdk/keyvault/azure-keyvault-administration/tests/test_examples_administration.py +++ b/sdk/keyvault/azure-keyvault-administration/tests/test_examples_administration.py @@ -4,6 +4,8 @@ # ------------------------------------ import time +import pytest + from _shared.test_case import KeyVaultTestCase from _test_case import AdministrationTestCase, backup_client_setup, get_decorator @@ -18,6 +20,9 @@ def __init__(self, *args, **kwargs): @all_api_versions() @backup_client_setup def test_example_backup_and_restore(self, client): + if self.is_live: + pytest.skip("SAS token failures are causing sev2 alerts for service team") + backup_client = client container_uri = self.container_uri sas_token = self.sas_token @@ -53,6 +58,9 @@ def test_example_backup_and_restore(self, client): @all_api_versions() @backup_client_setup def test_example_selective_key_restore(self, client): + if self.is_live: + pytest.skip("SAS token failures are causing sev2 alerts for service team") + # create a key to selectively restore key_client = self.create_key_client(self.managed_hsm_url) key_name = self.get_resource_name("selective-restore-test-key") diff --git a/sdk/keyvault/azure-keyvault-administration/tests/test_examples_administration_async.py b/sdk/keyvault/azure-keyvault-administration/tests/test_examples_administration_async.py index 65d449829500..83912e5c4039 100644 --- a/sdk/keyvault/azure-keyvault-administration/tests/test_examples_administration_async.py +++ b/sdk/keyvault/azure-keyvault-administration/tests/test_examples_administration_async.py @@ -4,6 +4,8 @@ # ------------------------------------ import asyncio +import pytest + from _shared.test_case_async import KeyVaultTestCase from _test_case import AdministrationTestCase, backup_client_setup, get_decorator @@ -18,6 +20,9 @@ def __init__(self, *args, **kwargs): @all_api_versions() @backup_client_setup async def test_example_backup_and_restore(self, client): + if self.is_live: + pytest.skip("SAS token failures are causing sev2 alerts for service team") + backup_client = client container_uri = self.container_uri sas_token = self.sas_token @@ -53,6 +58,9 @@ async def test_example_backup_and_restore(self, client): @all_api_versions() @backup_client_setup async def test_example_selective_key_restore(self, client): + if self.is_live: + pytest.skip("SAS token failures are causing sev2 alerts for service team") + # create a key to selectively restore key_client = self.create_key_client(self.managed_hsm_url, is_async=True) key_name = self.get_resource_name("selective-restore-test-key")