From a114e91316ef7e1c056490c178c42b53ea05a7d7 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Tue, 5 Oct 2021 18:57:57 -0700 Subject: [PATCH 01/16] Add Quantum CLI extension tests.live files --- src/quantum/tests.live/README.md | 13 +++++++++++++ src/quantum/tests.live/Run.ps1 | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/quantum/tests.live/README.md create mode 100644 src/quantum/tests.live/Run.ps1 diff --git a/src/quantum/tests.live/README.md b/src/quantum/tests.live/README.md new file mode 100644 index 00000000000..8f538be46c7 --- /dev/null +++ b/src/quantum/tests.live/README.md @@ -0,0 +1,13 @@ +# Quantum CLI Extension Live tests + +This folder contains Run.ps1, a script the will run all of the live tests for the Quantum CLI Extension. Live tests are end-to-end tests that require an actual connection with Azure Quantum +to complete successfully. + + +## Running locally + +1. Login to Azure using either: + * the [Azure Account extension in VS Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) + * `az login` from the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/) + +2. Use [`.\Run.ps1 -SkipInstall`](.\Run.ps1) to run all the tests. diff --git a/src/quantum/tests.live/Run.ps1 b/src/quantum/tests.live/Run.ps1 new file mode 100644 index 00000000000..347345c42ae --- /dev/null +++ b/src/quantum/tests.live/Run.ps1 @@ -0,0 +1,32 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +param ( + [Parameter()] + [switch] + $SkipInstall=$False +) + +# For debug, print all relevant environment variables: +Get-ChildItem env:AZURE*, env:*VERSION, env:*OUTDIR | Format-Table | Out-String | Write-Host + +<# >>>>> Code from IQ# Run.ps1 script: The CLI Extension tests probably won't use Pester <<<<< +# Install and run Pester +Import-Module Pester + +$config = [PesterConfiguration]::Default +$config.Run.Exit = $true +$config.TestResult.Enabled = $true +$config.TestResult.OutputPath = "TestResults.xml" +$config.TestResult.OutputFormat = "JUnitXml" +$config.Output.Verbosity = "Detailed" + +Invoke-Pester -Configuration $config -Verbose +<<<<< #> + +# Run the Quantum CLI Extension tests in an azdev environment +env\Scripts\activate.ps1 +azdev extension add quantum +az account set -s 916dfd6d-030c-4bd9-b579-7bb6d1926e97 +azdev test quantum --live +#<<<<< Will this work? <<<<< +#<<<<< What about the Azure login? Does that happen somewhere else? <<<<< \ No newline at end of file From a2daf7068b2dd87e471d068afcd5bb8a3fc5a089 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Wed, 6 Oct 2021 09:51:27 -0700 Subject: [PATCH 02/16] Delete commented-out code --- src/quantum/tests.live/Run.ps1 | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/quantum/tests.live/Run.ps1 b/src/quantum/tests.live/Run.ps1 index 347345c42ae..e1c822d5e11 100644 --- a/src/quantum/tests.live/Run.ps1 +++ b/src/quantum/tests.live/Run.ps1 @@ -9,24 +9,8 @@ param ( # For debug, print all relevant environment variables: Get-ChildItem env:AZURE*, env:*VERSION, env:*OUTDIR | Format-Table | Out-String | Write-Host -<# >>>>> Code from IQ# Run.ps1 script: The CLI Extension tests probably won't use Pester <<<<< -# Install and run Pester -Import-Module Pester - -$config = [PesterConfiguration]::Default -$config.Run.Exit = $true -$config.TestResult.Enabled = $true -$config.TestResult.OutputPath = "TestResults.xml" -$config.TestResult.OutputFormat = "JUnitXml" -$config.Output.Verbosity = "Detailed" - -Invoke-Pester -Configuration $config -Verbose -<<<<< #> - # Run the Quantum CLI Extension tests in an azdev environment env\Scripts\activate.ps1 azdev extension add quantum az account set -s 916dfd6d-030c-4bd9-b579-7bb6d1926e97 azdev test quantum --live -#<<<<< Will this work? <<<<< -#<<<<< What about the Azure login? Does that happen somewhere else? <<<<< \ No newline at end of file From f204c00d2ffd7af5714220074f5e0480fe688ce0 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Sun, 10 Oct 2021 16:00:42 -0700 Subject: [PATCH 03/16] Add azdev setup --- src/quantum/tests.live/Run.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/quantum/tests.live/Run.ps1 b/src/quantum/tests.live/Run.ps1 index e1c822d5e11..d8ab36d7174 100644 --- a/src/quantum/tests.live/Run.ps1 +++ b/src/quantum/tests.live/Run.ps1 @@ -10,7 +10,11 @@ param ( Get-ChildItem env:AZURE*, env:*VERSION, env:*OUTDIR | Format-Table | Out-String | Write-Host # Run the Quantum CLI Extension tests in an azdev environment +python -m venv env env\Scripts\activate.ps1 +python -m pip install -U pip +pip install azdev +azdev setup --cli ./src/subrepos/azure_cli --repo ./src/subrepos/cli_extensions azdev extension add quantum az account set -s 916dfd6d-030c-4bd9-b579-7bb6d1926e97 azdev test quantum --live From 174d48516117d8c63d28cbb47f1969760005cb5e Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Sun, 10 Oct 2021 16:49:22 -0700 Subject: [PATCH 04/16] Fix azdev setup path params --- src/quantum/tests.live/Run.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quantum/tests.live/Run.ps1 b/src/quantum/tests.live/Run.ps1 index d8ab36d7174..d6a2ebd3fa7 100644 --- a/src/quantum/tests.live/Run.ps1 +++ b/src/quantum/tests.live/Run.ps1 @@ -14,7 +14,7 @@ python -m venv env env\Scripts\activate.ps1 python -m pip install -U pip pip install azdev -azdev setup --cli ./src/subrepos/azure_cli --repo ./src/subrepos/cli_extensions +azdev setup --cli /a/1/s/src/subrepos/azure_cli --repo /a/1/s/src/subrepos/cli_extension azdev extension add quantum az account set -s 916dfd6d-030c-4bd9-b579-7bb6d1926e97 azdev test quantum --live From 2095d4538ba23927412142e34a07a012b1986a42 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Sun, 10 Oct 2021 17:22:19 -0700 Subject: [PATCH 05/16] Add Set-Location in Run.ps1 --- src/quantum/tests.live/Run.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/quantum/tests.live/Run.ps1 b/src/quantum/tests.live/Run.ps1 index d6a2ebd3fa7..941b2ff78e3 100644 --- a/src/quantum/tests.live/Run.ps1 +++ b/src/quantum/tests.live/Run.ps1 @@ -10,11 +10,12 @@ param ( Get-ChildItem env:AZURE*, env:*VERSION, env:*OUTDIR | Format-Table | Out-String | Write-Host # Run the Quantum CLI Extension tests in an azdev environment +Set-Location ../../.. python -m venv env env\Scripts\activate.ps1 python -m pip install -U pip pip install azdev -azdev setup --cli /a/1/s/src/subrepos/azure_cli --repo /a/1/s/src/subrepos/cli_extension +azdev setup --cli ../azure_cli --repo . azdev extension add quantum az account set -s 916dfd6d-030c-4bd9-b579-7bb6d1926e97 azdev test quantum --live From c0c3b41e1842d175680d1cde7777feabc036dec3 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Sun, 10 Oct 2021 18:38:51 -0700 Subject: [PATCH 06/16] Omit --cli param for azdev setup --- src/quantum/tests.live/Run.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quantum/tests.live/Run.ps1 b/src/quantum/tests.live/Run.ps1 index 941b2ff78e3..968a3a8287d 100644 --- a/src/quantum/tests.live/Run.ps1 +++ b/src/quantum/tests.live/Run.ps1 @@ -15,7 +15,7 @@ python -m venv env env\Scripts\activate.ps1 python -m pip install -U pip pip install azdev -azdev setup --cli ../azure_cli --repo . +azdev setup --repo . azdev extension add quantum az account set -s 916dfd6d-030c-4bd9-b579-7bb6d1926e97 azdev test quantum --live From 70630192083c54297d35b1fbaca06c8d7ef242c4 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Mon, 11 Oct 2021 11:51:41 -0700 Subject: [PATCH 07/16] Use environment variable for Subscription ID --- src/quantum/tests.live/Run.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quantum/tests.live/Run.ps1 b/src/quantum/tests.live/Run.ps1 index 968a3a8287d..20010a1bc22 100644 --- a/src/quantum/tests.live/Run.ps1 +++ b/src/quantum/tests.live/Run.ps1 @@ -17,5 +17,5 @@ python -m pip install -U pip pip install azdev azdev setup --repo . azdev extension add quantum -az account set -s 916dfd6d-030c-4bd9-b579-7bb6d1926e97 +az account set -s $Env:AZURE_QUANTUM_SUBSCRIPTION_ID azdev test quantum --live From cef55d85cba298986de3bae4c9925e734f234273 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Mon, 11 Oct 2021 14:56:38 -0700 Subject: [PATCH 08/16] Update environment variable names --- src/quantum/azext_quantum/tests/latest/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/quantum/azext_quantum/tests/latest/utils.py b/src/quantum/azext_quantum/tests/latest/utils.py index ca485311635..225daefe3e9 100644 --- a/src/quantum/azext_quantum/tests/latest/utils.py +++ b/src/quantum/azext_quantum/tests/latest/utils.py @@ -14,19 +14,19 @@ def get_from_os_environment(env_name, default): return os.environ[env_name] if env_name in os.environ and os.environ[env_name] != "" else default def get_test_subscription_id(): - return get_from_os_environment("AZUREQUANTUM_SUBSCRIPTION_ID", TEST_SUBS_DEFAULT) + return get_from_os_environment("AZURE_QUANTUM_SUBSCRIPTION_ID", TEST_SUBS_DEFAULT) def get_test_resource_group(): - return get_from_os_environment("AZUREQUANTUM_WORKSPACE_RG", TEST_RG_DEFAULT) + return get_from_os_environment("AZURE_QUANTUM_WORKSPACE_RG", TEST_RG_DEFAULT) def get_test_workspace(): - return get_from_os_environment("AZUREQUANTUM_WORKSPACE_NAME", TEST_WORKSPACE_DEFAULT) + return get_from_os_environment("AZURE_QUANTUM_WORKSPACE_NAME", TEST_WORKSPACE_DEFAULT) def get_test_workspace_location(): - return get_from_os_environment("AZUREQUANTUM_WORKSPACE_LOCATION", TEST_WORKSPACE_DEFAULT_LOCATION) + return get_from_os_environment("AZURE_QUANTUM_WORKSPACE_LOCATION", TEST_WORKSPACE_DEFAULT_LOCATION) def get_test_workspace_storage(): - return get_from_os_environment("AZUREQUANTUM_WORKSPACE_STORAGE", TEST_WORKSPACE_DEFAULT_STORAGE) + return get_from_os_environment("AZURE_QUANTUM_WORKSPACE_STORAGE", TEST_WORKSPACE_DEFAULT_STORAGE) def get_test_workspace_random_name(): import random From d443b9481df9b00693a5829b6c435e7cb268c877 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Mon, 11 Oct 2021 16:40:30 -0700 Subject: [PATCH 09/16] Update 'Running locally' instructions in README.md --- src/quantum/tests.live/README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/quantum/tests.live/README.md b/src/quantum/tests.live/README.md index 8f538be46c7..f4027bfa371 100644 --- a/src/quantum/tests.live/README.md +++ b/src/quantum/tests.live/README.md @@ -6,8 +6,13 @@ to complete successfully. ## Running locally -1. Login to Azure using either: +1. Set the following environment variable to the Subscription ID of the "QuArC Internal Consumption" subscription: + * `$Env:AZURE_QUANTUM_SUBSCRIPTION_ID = "[Subscription ID]"` + +2. Login to Azure using either: * the [Azure Account extension in VS Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) * `az login` from the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/) -2. Use [`.\Run.ps1 -SkipInstall`](.\Run.ps1) to run all the tests. +3. Make this folder your current directory location: src\quantum\tests.live + +4. Use [`.\Run.ps1 -SkipInstall`](.\Run.ps1) to run all the tests. From 22ff1f716204d32f0dc5be2a545e1a8409391a97 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Thu, 14 Oct 2021 13:06:57 -0700 Subject: [PATCH 10/16] Skip test if provider not in AZURE_QUANTUM_CAPABILITIES --- .../tests/latest/test_quantum_workspace.py | 32 +++++++++++-------- .../azext_quantum/tests/latest/utils.py | 8 +++++ src/quantum/tests.live/Run.ps1 | 2 +- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py b/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py index aafdb168db1..e9844199bec 100644 --- a/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py +++ b/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py @@ -9,7 +9,7 @@ from azure_devtools.scenario_tests import AllowLargeResponse, live_only from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer) -from .utils import get_test_resource_group, get_test_workspace, get_test_workspace_location, get_test_workspace_storage, get_test_workspace_random_name +from .utils import get_test_resource_group, get_test_workspace, get_test_workspace_location, get_test_workspace_storage, get_test_workspace_random_name, get_test_capabilities, get_test_workspace_provider_sku_list from ..._version_check_helper import check_version from datetime import datetime from ...__init__ import CLI_REPORTED_VERSION @@ -55,18 +55,24 @@ def test_workspace_create_destroy(self): test_resource_group = get_test_resource_group() test_workspace_temp = get_test_workspace_random_name() test_storage_account = get_test_workspace_storage() - - # create - self.cmd(f'az quantum workspace create -g {test_resource_group} -w {test_workspace_temp} -l {test_location} -a {test_storage_account} -r "Microsoft/Basic" -o json --skip-role-assignment', checks=[ - self.check("name", test_workspace_temp), - self.check("provisioningState", "Accepted") # Status is accepted since we're not linking the storage account. - ]) - - # delete - self.cmd(f'az quantum workspace delete -g {test_resource_group} -w {test_workspace_temp} -o json', checks=[ - self.check("name", test_workspace_temp), - self.check("provisioningState", "Deleting") - ]) + test_provider_sku_list = get_test_workspace_provider_sku_list() + test_capabilities = get_test_capabilities() + test_provider = "new." + test_provider_sku_list.split(';')[0].split('/')[0].lower() + + if test_provider in test_capabilities: + # create + self.cmd(f'az quantum workspace create -g {test_resource_group} -w {test_workspace_temp} -l {test_location} -a {test_storage_account} -r {test_provider_sku_list} -o json --skip-role-assignment', checks=[ + self.check("name", test_workspace_temp), + self.check("provisioningState", "Accepted") # Status is accepted since we're not linking the storage account. + ]) + + # delete + self.cmd(f'az quantum workspace delete -g {test_resource_group} -w {test_workspace_temp} -o json', checks=[ + self.check("name", test_workspace_temp), + self.check("provisioningState", "Deleting") + ]) + else: + self.skipTest(f"Skipping test_workspace_create_destroy: Provider {test_provider} not found in AZURE_QUANTUM_CAPABILITIES") @live_only() def test_version_check(self): diff --git a/src/quantum/azext_quantum/tests/latest/utils.py b/src/quantum/azext_quantum/tests/latest/utils.py index 225daefe3e9..f68079875ff 100644 --- a/src/quantum/azext_quantum/tests/latest/utils.py +++ b/src/quantum/azext_quantum/tests/latest/utils.py @@ -8,6 +8,8 @@ TEST_WORKSPACE_DEFAULT = "e2e-qsharp-tests" TEST_WORKSPACE_DEFAULT_LOCATION = "westus2" TEST_WORKSPACE_DEFAULT_STORAGE = "/subscriptions/916dfd6d-030c-4bd9-b579-7bb6d1926e97/resourceGroups/e2e-scenarios/providers/Microsoft.Storage/storageAccounts/e2etests" +TEST_WORKSPACE_DEFAULT_PROVIDER_SKU_LIST = "Microsoft/Basic" +TEST_CAPABILITIES_DEFAULT = "new.microsoft;submit.microsoft" def get_from_os_environment(env_name, default): import os @@ -28,6 +30,12 @@ def get_test_workspace_location(): def get_test_workspace_storage(): return get_from_os_environment("AZURE_QUANTUM_WORKSPACE_STORAGE", TEST_WORKSPACE_DEFAULT_STORAGE) +def get_test_workspace_provider_sku_list(): + return get_from_os_environment("AZURE_QUANTUM_WORKSPACE_PROVIDER_SKU_LIST", TEST_WORKSPACE_DEFAULT_PROVIDER_SKU_LIST) + +def get_test_capabilities(): + return get_from_os_environment("AZURE_QUANTUM_CAPABILITIES", TEST_CAPABILITIES_DEFAULT) + def get_test_workspace_random_name(): import random return "e2e-test-w" + str(random.randint(1000000, 9999999)) diff --git a/src/quantum/tests.live/Run.ps1 b/src/quantum/tests.live/Run.ps1 index 20010a1bc22..fa6ac4663f7 100644 --- a/src/quantum/tests.live/Run.ps1 +++ b/src/quantum/tests.live/Run.ps1 @@ -18,4 +18,4 @@ pip install azdev azdev setup --repo . azdev extension add quantum az account set -s $Env:AZURE_QUANTUM_SUBSCRIPTION_ID -azdev test quantum --live +azdev test quantum --live --verbose From e0062bf48bf868b2e3c2ee64140066baa5928489 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Thu, 14 Oct 2021 13:38:09 -0700 Subject: [PATCH 11/16] Convert capabilities string to lowercase --- src/quantum/azext_quantum/tests/latest/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quantum/azext_quantum/tests/latest/utils.py b/src/quantum/azext_quantum/tests/latest/utils.py index f68079875ff..9c6e7c85ed6 100644 --- a/src/quantum/azext_quantum/tests/latest/utils.py +++ b/src/quantum/azext_quantum/tests/latest/utils.py @@ -34,7 +34,7 @@ def get_test_workspace_provider_sku_list(): return get_from_os_environment("AZURE_QUANTUM_WORKSPACE_PROVIDER_SKU_LIST", TEST_WORKSPACE_DEFAULT_PROVIDER_SKU_LIST) def get_test_capabilities(): - return get_from_os_environment("AZURE_QUANTUM_CAPABILITIES", TEST_CAPABILITIES_DEFAULT) + return get_from_os_environment("AZURE_QUANTUM_CAPABILITIES", TEST_CAPABILITIES_DEFAULT).lower() def get_test_workspace_random_name(): import random From 76374b9176d27fc7d50f3983ab5a0dae73310666 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Thu, 14 Oct 2021 14:05:10 -0700 Subject: [PATCH 12/16] Use --xml-path param to save test output with the recordings --- .../azext_quantum/tests/latest/recordings/test_results.xml | 1 + src/quantum/tests.live/Run.ps1 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 src/quantum/azext_quantum/tests/latest/recordings/test_results.xml diff --git a/src/quantum/azext_quantum/tests/latest/recordings/test_results.xml b/src/quantum/azext_quantum/tests/latest/recordings/test_results.xml new file mode 100644 index 00000000000..7d2c3705911 --- /dev/null +++ b/src/quantum/azext_quantum/tests/latest/recordings/test_results.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/quantum/tests.live/Run.ps1 b/src/quantum/tests.live/Run.ps1 index fa6ac4663f7..7b5a97fd6ec 100644 --- a/src/quantum/tests.live/Run.ps1 +++ b/src/quantum/tests.live/Run.ps1 @@ -18,4 +18,4 @@ pip install azdev azdev setup --repo . azdev extension add quantum az account set -s $Env:AZURE_QUANTUM_SUBSCRIPTION_ID -azdev test quantum --live --verbose +azdev test quantum --live --verbose --xml-path src\quantum\azext_quantum\tests\latest\recordings From 66737801149a77a497c5d3921f57fc4792abceb1 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Thu, 14 Oct 2021 17:58:20 -0700 Subject: [PATCH 13/16] Handle multiple providers in capabilities logic --- .../azext_quantum/tests/latest/test_quantum_workspace.py | 8 +++----- src/quantum/azext_quantum/tests/latest/utils.py | 7 ++++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py b/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py index e9844199bec..bb0452c61d7 100644 --- a/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py +++ b/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py @@ -9,7 +9,7 @@ from azure_devtools.scenario_tests import AllowLargeResponse, live_only from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer) -from .utils import get_test_resource_group, get_test_workspace, get_test_workspace_location, get_test_workspace_storage, get_test_workspace_random_name, get_test_capabilities, get_test_workspace_provider_sku_list +from .utils import get_test_resource_group, get_test_workspace, get_test_workspace_location, get_test_workspace_storage, get_test_workspace_random_name, get_test_capabilities, get_test_workspace_provider_sku_list, all_providers_are_in_capabilities from ..._version_check_helper import check_version from datetime import datetime from ...__init__ import CLI_REPORTED_VERSION @@ -56,10 +56,8 @@ def test_workspace_create_destroy(self): test_workspace_temp = get_test_workspace_random_name() test_storage_account = get_test_workspace_storage() test_provider_sku_list = get_test_workspace_provider_sku_list() - test_capabilities = get_test_capabilities() - test_provider = "new." + test_provider_sku_list.split(';')[0].split('/')[0].lower() - if test_provider in test_capabilities: + if all_providers_are_in_capabilities(test_provider_sku_list, get_test_capabilities()): # create self.cmd(f'az quantum workspace create -g {test_resource_group} -w {test_workspace_temp} -l {test_location} -a {test_storage_account} -r {test_provider_sku_list} -o json --skip-role-assignment', checks=[ self.check("name", test_workspace_temp), @@ -72,7 +70,7 @@ def test_workspace_create_destroy(self): self.check("provisioningState", "Deleting") ]) else: - self.skipTest(f"Skipping test_workspace_create_destroy: Provider {test_provider} not found in AZURE_QUANTUM_CAPABILITIES") + self.skipTest(f"Skipping test_workspace_create_destroy: One or more providers in '{test_provider_sku_list}' not found in AZURE_QUANTUM_CAPABILITIES") @live_only() def test_version_check(self): diff --git a/src/quantum/azext_quantum/tests/latest/utils.py b/src/quantum/azext_quantum/tests/latest/utils.py index 9c6e7c85ed6..e9eb48e1f33 100644 --- a/src/quantum/azext_quantum/tests/latest/utils.py +++ b/src/quantum/azext_quantum/tests/latest/utils.py @@ -40,4 +40,9 @@ def get_test_workspace_random_name(): import random return "e2e-test-w" + str(random.randint(1000000, 9999999)) - +def all_providers_are_in_capabilities(provider_sku_string, capabilities_string): + for provide_sku_pair in provider_sku_string.split(';'): + provider = "new." + provide_sku_pair.split('/')[0].lower() + if provider not in capabilities_string: + return False + return True From abc210a2f5fc40907dbb2ad64aa7979f8f6fcd43 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Mon, 18 Oct 2021 11:49:07 -0700 Subject: [PATCH 14/16] Test re-run From 596b01536947817ac599f0452bd80c167f3fe09b Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Mon, 18 Oct 2021 14:54:43 -0700 Subject: [PATCH 15/16] Test re-run, Take 2 From 06139160b1f208fbc3c3b4928fc210d89d551735 Mon Sep 17 00:00:00 2001 From: "Warren Jones (Harvey Nash" Date: Tue, 19 Oct 2021 12:28:43 -0700 Subject: [PATCH 16/16] Remove test_results.xml --- .../azext_quantum/tests/latest/recordings/test_results.xml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 src/quantum/azext_quantum/tests/latest/recordings/test_results.xml diff --git a/src/quantum/azext_quantum/tests/latest/recordings/test_results.xml b/src/quantum/azext_quantum/tests/latest/recordings/test_results.xml deleted file mode 100644 index 7d2c3705911..00000000000 --- a/src/quantum/azext_quantum/tests/latest/recordings/test_results.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file