1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Update Azure module test infrastructure.

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

ci_complete
This commit is contained in:
Matt Clay 2017-12-07 12:42:35 -08:00
parent fb0343cd12
commit ad4975d3e7
2 changed files with 18 additions and 2 deletions

View file

@ -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):

View file

@ -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',