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

core: capture exceptions caused by unregistered provider and auto-register it #3045

Merged
merged 10 commits into from
May 1, 2017
Prev Previous commit
Next Next commit
remove a pylint suppression
  • Loading branch information
yugangw-msft committed May 1, 2017
commit a5ea769416ed648f8c4bc0f38f1039a23ce97a6b
10 changes: 5 additions & 5 deletions src/azure-cli-core/tests/test_rp_auto_reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@
from azure.cli.core.commands import _check_rp_not_registered_err


# pylint: disable=line-too-long


class TestRPAutoRegister(ScenarioTest):
def setUp(self):
if self.in_recording:
# note, unregistering a registered provider might take a long while(10+ mins)
result = self.cmd('provider show -n Microsoft.Sql --query "registrationState" -o tsv').output
result = self.cmd('provider show -n Microsoft.Sql '
'--query "registrationState" -o tsv').output
if result.lower().strip() != 'unregistered':
self.cmd('provider unregister -n Microsoft.Sql --wait')
time.sleep(30) # a bit random but like to ensure unregistering went through
return super(TestRPAutoRegister, self).setUp()

@ResourceGroupPreparer()
def test_rp_auto_register(self, resource_group, resource_group_location):
self.cmd('sql server create -g {} -n ygserver123 -l {} --admin-user sa123 --admin-password verySecret12345'.format(resource_group, resource_group_location), checks=[
cmd = ('sql server create -g {} -n ygserver123 -l {} --admin-user sa123 '
'--admin-password verySecret12345')
self.cmd(cmd.format(resource_group, resource_group_location), checks=[
JMESPathCheck('name', 'ygserver123')
])
self.cmd('provider show -n Microsoft.Sql', checks=[
Expand Down