mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-02 15:21:25 -07: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:
parent
fb0343cd12
commit
ad4975d3e7
2 changed files with 18 additions and 2 deletions
|
@ -30,6 +30,14 @@ class AzureCloudProvider(CloudProvider):
|
||||||
"""Azure cloud provider plugin. Sets up cloud resources before delegation."""
|
"""Azure cloud provider plugin. Sets up cloud resources before delegation."""
|
||||||
SHERLOCK_CONFIG_PATH = os.path.expanduser('~/.ansible-sherlock-ci.cfg')
|
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):
|
def filter(self, targets, exclude):
|
||||||
"""Filter out the cloud tests when the necessary config and resources are not available.
|
"""Filter out the cloud tests when the necessary config and resources are not available.
|
||||||
:type targets: tuple[TestTarget]
|
:type targets: tuple[TestTarget]
|
||||||
|
@ -60,6 +68,13 @@ class AzureCloudProvider(CloudProvider):
|
||||||
|
|
||||||
get_config(self.config_path) # check required variables
|
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):
|
def _setup_dynamic(self):
|
||||||
"""Request Azure credentials through Sherlock."""
|
"""Request Azure credentials through Sherlock."""
|
||||||
display.info('Provisioning %s cloud environment.' % self.platform, verbosity=1)
|
display.info('Provisioning %s cloud environment.' % self.platform, verbosity=1)
|
||||||
|
@ -95,6 +110,7 @@ class AzureCloudProvider(CloudProvider):
|
||||||
|
|
||||||
if not self.args.explain:
|
if not self.args.explain:
|
||||||
response = aci_result['azure']
|
response = aci_result['azure']
|
||||||
|
self.aci = aci
|
||||||
|
|
||||||
if not self.args.explain:
|
if not self.args.explain:
|
||||||
values = dict(
|
values = dict(
|
||||||
|
@ -114,7 +130,7 @@ class AzureCloudProvider(CloudProvider):
|
||||||
"""
|
"""
|
||||||
:rtype: AnsibleCoreCI
|
: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):
|
class AzureCloudEnvironment(CloudEnvironment):
|
||||||
|
|
|
@ -64,7 +64,6 @@ class AnsibleCoreCI(object):
|
||||||
providers = dict(
|
providers = dict(
|
||||||
aws=(
|
aws=(
|
||||||
'aws',
|
'aws',
|
||||||
'azure',
|
|
||||||
'windows',
|
'windows',
|
||||||
'freebsd',
|
'freebsd',
|
||||||
'rhel',
|
'rhel',
|
||||||
|
@ -73,6 +72,7 @@ class AnsibleCoreCI(object):
|
||||||
'ios',
|
'ios',
|
||||||
),
|
),
|
||||||
azure=(
|
azure=(
|
||||||
|
'azure',
|
||||||
),
|
),
|
||||||
parallels=(
|
parallels=(
|
||||||
'osx',
|
'osx',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue