Update Azure module test infrastructure.

- Use new Azure direct API implementation.
- Enable Azure tests to clean up on exit.

ci_complete
pull/33700/merge
Matt Clay 7 years ago
parent fb0343cd12
commit ad4975d3e7

@ -30,6 +30,14 @@ class AzureCloudProvider(CloudProvider):
"""Azure cloud provider plugin. Sets up cloud resources before delegation."""
SHERLOCK_CONFIG_PATH = os.path.expanduser('~/.ansible-sherlock-ci.cfg')
def __init__(self, args):
"""
:type args: TestConfig
"""
super(AzureCloudProvider, self).__init__(args)
self.aci = None
def filter(self, targets, exclude):
"""Filter out the cloud tests when the necessary config and resources are not available.
:type targets: tuple[TestTarget]
@ -60,6 +68,13 @@ class AzureCloudProvider(CloudProvider):
get_config(self.config_path) # check required variables
def cleanup(self):
"""Clean up the cloud resource and any temporary configuration files after tests complete."""
if self.aci:
self.aci.stop()
super(AzureCloudProvider, self).cleanup()
def _setup_dynamic(self):
"""Request Azure credentials through Sherlock."""
display.info('Provisioning %s cloud environment.' % self.platform, verbosity=1)
@ -95,6 +110,7 @@ class AzureCloudProvider(CloudProvider):
if not self.args.explain:
response = aci_result['azure']
self.aci = aci
if not self.args.explain:
values = dict(
@ -114,7 +130,7 @@ class AzureCloudProvider(CloudProvider):
"""
:rtype: AnsibleCoreCI
"""
return AnsibleCoreCI(self.args, 'azure', 'sherlock', persist=False, stage=self.args.remote_stage, provider=self.args.remote_provider)
return AnsibleCoreCI(self.args, 'azure', 'azure', persist=False, stage=self.args.remote_stage, provider=self.args.remote_provider)
class AzureCloudEnvironment(CloudEnvironment):

@ -64,7 +64,6 @@ class AnsibleCoreCI(object):
providers = dict(
aws=(
'aws',
'azure',
'windows',
'freebsd',
'rhel',
@ -73,6 +72,7 @@ class AnsibleCoreCI(object):
'ios',
),
azure=(
'azure',
),
parallels=(
'osx',

Loading…
Cancel
Save