Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Quantum CLI Extension Live E2E Client Validation Tests #3943

Merged
merged 16 commits into from
Oct 21, 2021
Prev Previous commit
Next Next commit
Handle multiple providers in capabilities logic
Warren Jones (Harvey Nash committed Oct 19, 2021
commit 66737801149a77a497c5d3921f57fc4792abceb1
Original file line number Diff line number Diff line change
@@ -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):
7 changes: 6 additions & 1 deletion src/quantum/azext_quantum/tests/latest/utils.py
Original file line number Diff line number Diff line change
@@ -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