mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
fixed misspelled provider information
This commit is contained in:
parent
511779b8ca
commit
80efd26e8d
6 changed files with 21 additions and 82 deletions
|
@ -5,73 +5,23 @@ Integration tests for the Dimension Data cloud provider
|
|||
|
||||
# Import Python Libs
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import os
|
||||
|
||||
# Import Salt Testing Libs
|
||||
from tests.integration.cloud.helpers.cloud_test_base import CloudTest, TIMEOUT
|
||||
from tests.support.paths import FILES
|
||||
from tests.support.helpers import expensiveTest
|
||||
|
||||
# Import Salt Libs
|
||||
from salt.config import cloud_providers_config
|
||||
|
||||
|
||||
# Create the cloud instance name to be used throughout the tests
|
||||
PROVIDER_NAME = 'dimensiondata'
|
||||
|
||||
|
||||
class DimensionDataTest(CloudTest):
|
||||
'''
|
||||
Integration tests for the Dimension Data cloud provider in Salt-Cloud
|
||||
'''
|
||||
|
||||
@expensiveTest
|
||||
def setUp(self):
|
||||
'''
|
||||
Sets up the test requirements
|
||||
'''
|
||||
super(DimensionDataTest, self).setUp()
|
||||
|
||||
# check if appropriate cloud provider and profile files are present
|
||||
profile_str = 'dimensiondata-config'
|
||||
providers = self.run_cloud('--list-providers')
|
||||
if profile_str + ':' not in providers:
|
||||
self.skipTest(
|
||||
'Configuration file for {0} was not found. Check {0}.conf files '
|
||||
'in tests/integration/files/conf/cloud.*.d/ to run these tests.'
|
||||
.format(PROVIDER_NAME)
|
||||
)
|
||||
|
||||
# check if user_id, key, and region are present
|
||||
config = cloud_providers_config(
|
||||
os.path.join(
|
||||
FILES,
|
||||
'conf',
|
||||
'cloud.providers.d',
|
||||
PROVIDER_NAME + '.conf'
|
||||
)
|
||||
)
|
||||
|
||||
user_id = config[profile_str][PROVIDER_NAME]['user_id']
|
||||
key = config[profile_str][PROVIDER_NAME]['key']
|
||||
region = config[profile_str][PROVIDER_NAME]['region']
|
||||
|
||||
if not all((user_id, key, region)):
|
||||
self.skipTest(
|
||||
'A user Id, password, and a region '
|
||||
'must be provided to run these tests. Check '
|
||||
'tests/integration/files/conf/cloud.providers.d/{0}.conf'
|
||||
.format(PROVIDER_NAME)
|
||||
)
|
||||
|
||||
self.assertFalse(self._instance_exists(),
|
||||
'The instance "{}" exists before it was created by the test'.format(self.instance_name))
|
||||
PROVIDER = 'dimensiondata'
|
||||
REQUIRED_CONFIG_ITEMS = ('key', 'region', 'user_id')
|
||||
|
||||
def test_list_images(self):
|
||||
'''
|
||||
Tests the return of running the --list-images command for the dimensiondata cloud provider
|
||||
'''
|
||||
image_list = self.run_cloud('--list-images {0}'.format(PROVIDER_NAME))
|
||||
image_list = self.run_cloud('--list-images {0}'.format(self.PROVIDER))
|
||||
self.assertIn(
|
||||
'Ubuntu 14.04 2 CPU',
|
||||
[i.strip() for i in image_list]
|
||||
|
@ -81,7 +31,7 @@ class DimensionDataTest(CloudTest):
|
|||
'''
|
||||
Tests the return of running the --list-locations command for the dimensiondata cloud provider
|
||||
'''
|
||||
_list_locations = self.run_cloud('--list-locations {0}'.format(PROVIDER_NAME))
|
||||
_list_locations = self.run_cloud('--list-locations {0}'.format(self.PROVIDER))
|
||||
self.assertIn(
|
||||
'Australia - Melbourne MCP2',
|
||||
[i.strip() for i in _list_locations]
|
||||
|
@ -91,7 +41,7 @@ class DimensionDataTest(CloudTest):
|
|||
'''
|
||||
Tests the return of running the --list-sizes command for the dimensiondata cloud provider
|
||||
'''
|
||||
_list_sizes = self.run_cloud('--list-sizes {0}'.format(PROVIDER_NAME))
|
||||
_list_sizes = self.run_cloud('--list-sizes {0}'.format(self.PROVIDER))
|
||||
self.assertIn(
|
||||
'default',
|
||||
[i.strip() for i in _list_sizes]
|
||||
|
|
|
@ -60,11 +60,11 @@ class EC2Test(CloudTest):
|
|||
'''
|
||||
Sets up the test requirements
|
||||
'''
|
||||
group_or_subnet = self.provider_config[self.profile_str][self.PROVIDER_NAME].get('securitygroup', '')
|
||||
group_or_subnet = self.provider_config[self.profile_str][self.PROVIDER].get('securitygroup', '')
|
||||
if not group_or_subnet:
|
||||
group_or_subnet = self.provider_config[self.profile_str][self.PROVIDER_NAME].get('subnetid', '')
|
||||
group_or_subnet = self.provider_config[self.profile_str][self.PROVIDER].get('subnetid', '')
|
||||
|
||||
self.assertTrue(group_or_subnet, 'securitygroup or subnetid missing for {} config'.format(self.PROVIDER_NAME))
|
||||
self.assertTrue(group_or_subnet, 'securitygroup or subnetid missing for {} config'.format(self.PROVIDER))
|
||||
|
||||
super(EC2Test, self).setUp()
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class ProfitBricksTest(CloudTest):
|
|||
'''
|
||||
Tests the return of running the --list-images command for ProfitBricks
|
||||
'''
|
||||
list_images = self.run_cloud('--list-images {0}'.format(self.PROVIDER_NAME))
|
||||
list_images = self.run_cloud('--list-images {0}'.format(self.PROVIDER))
|
||||
self.assertIn(
|
||||
'Ubuntu-16.04-LTS-server-2017-10-01',
|
||||
[i.strip() for i in list_images]
|
||||
|
@ -44,7 +44,7 @@ class ProfitBricksTest(CloudTest):
|
|||
Tests the return of running the -f list_images
|
||||
command for ProfitBricks
|
||||
'''
|
||||
cmd = '-f list_images {0}'.format(self.PROVIDER_NAME)
|
||||
cmd = '-f list_images {0}'.format(self.PROVIDER)
|
||||
list_images = self.run_cloud(cmd)
|
||||
self.assertIn(
|
||||
'- ubuntu:latest',
|
||||
|
@ -55,7 +55,7 @@ class ProfitBricksTest(CloudTest):
|
|||
'''
|
||||
Tests the return of running the --list_sizes command for ProfitBricks
|
||||
'''
|
||||
list_sizes = self.run_cloud('--list-sizes {0}'.format(self.PROVIDER_NAME))
|
||||
list_sizes = self.run_cloud('--list-sizes {0}'.format(self.PROVIDER))
|
||||
self.assertIn(
|
||||
'Micro Instance:',
|
||||
[i.strip() for i in list_sizes]
|
||||
|
@ -66,7 +66,7 @@ class ProfitBricksTest(CloudTest):
|
|||
Tests the return of running the -f list_datacenters
|
||||
command for ProfitBricks
|
||||
'''
|
||||
cmd = '-f list_datacenters {0}'.format(self.PROVIDER_NAME)
|
||||
cmd = '-f list_datacenters {0}'.format(self.PROVIDER)
|
||||
list_datacenters = self.run_cloud(cmd)
|
||||
self.assertIn(
|
||||
self.datacenter_id,
|
||||
|
@ -77,7 +77,7 @@ class ProfitBricksTest(CloudTest):
|
|||
'''
|
||||
Tests the return of running the -f list_nodes command for ProfitBricks
|
||||
'''
|
||||
list_nodes = self.run_cloud('-f list_nodes {0}'.format(self.PROVIDER_NAME))
|
||||
list_nodes = self.run_cloud('-f list_nodes {0}'.format(self.PROVIDER))
|
||||
self.assertIn(
|
||||
'state:',
|
||||
[i.strip() for i in list_nodes]
|
||||
|
@ -93,7 +93,7 @@ class ProfitBricksTest(CloudTest):
|
|||
Tests the return of running the -f list_nodes_full
|
||||
command for ProfitBricks
|
||||
'''
|
||||
cmd = '-f list_nodes_full {0}'.format(self.PROVIDER_NAME)
|
||||
cmd = '-f list_nodes_full {0}'.format(self.PROVIDER)
|
||||
list_nodes = self.run_cloud(cmd)
|
||||
self.assertIn(
|
||||
'state:',
|
||||
|
@ -110,7 +110,7 @@ class ProfitBricksTest(CloudTest):
|
|||
Tests the return of running the --list-locations
|
||||
command for ProfitBricks
|
||||
'''
|
||||
cmd = '--list-locations {0}'.format(self.PROVIDER_NAME)
|
||||
cmd = '--list-locations {0}'.format(self.PROVIDER)
|
||||
list_locations = self.run_cloud(cmd)
|
||||
|
||||
self.assertIn(
|
||||
|
|
|
@ -5,15 +5,11 @@
|
|||
|
||||
# Import Python Libs
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import os
|
||||
|
||||
# Import Salt Libs
|
||||
from salt.config import cloud_config
|
||||
from salt.ext import six
|
||||
|
||||
# Import Salt Testing LIbs
|
||||
from tests.support.paths import FILES
|
||||
|
||||
# Create the cloud instance name to be used throughout the tests
|
||||
from tests.integration.cloud.helpers.cloud_test_base import TIMEOUT, CloudTest
|
||||
|
||||
|
@ -30,14 +26,7 @@ class VMWareTest(CloudTest):
|
|||
Tests creating and deleting an instance on vmware and installing salt
|
||||
'''
|
||||
# create the instance
|
||||
profile = os.path.join(
|
||||
FILES,
|
||||
'conf',
|
||||
'cloud.profiles.d',
|
||||
self.PROVIDER_NAME + '.conf'
|
||||
)
|
||||
|
||||
profile_config = cloud_config(profile)
|
||||
profile_config = cloud_config(self.provider_config)
|
||||
disk_datastore = profile_config['vmware-test']['devices']['disk']['Hard disk 2']['datastore']
|
||||
|
||||
ret_val = self.run_cloud('-p vmware-test {0}'.format(self.instance_name), timeout=TIMEOUT)
|
||||
|
|
|
@ -23,7 +23,7 @@ class VultrTest(CloudTest):
|
|||
'''
|
||||
Tests the return of running the --list-images command for Vultr
|
||||
'''
|
||||
image_list = self.run_cloud('--list-images {0}'.format(self.PROVIDER_NAME))
|
||||
image_list = self.run_cloud('--list-images {0}'.format(self.PROVIDER))
|
||||
|
||||
self.assertIn(
|
||||
'Debian 8 x64 (jessie)',
|
||||
|
@ -34,7 +34,7 @@ class VultrTest(CloudTest):
|
|||
'''
|
||||
Tests the return of running the --list-locations command for Vultr
|
||||
'''
|
||||
location_list = self.run_cloud('--list-locations {0}'.format(self.PROVIDER_NAME))
|
||||
location_list = self.run_cloud('--list-locations {0}'.format(self.PROVIDER))
|
||||
self.assertIn(
|
||||
'New Jersey',
|
||||
[i.strip() for i in location_list]
|
||||
|
@ -44,7 +44,7 @@ class VultrTest(CloudTest):
|
|||
'''
|
||||
Tests the return of running the --list-sizes command for Vultr
|
||||
'''
|
||||
size_list = self.run_cloud('--list-sizes {0}'.format(self.PROVIDER_NAME))
|
||||
size_list = self.run_cloud('--list-sizes {0}'.format(self.PROVIDER))
|
||||
self.assertIn(
|
||||
'32768 MB RAM,4x110 GB SSD,40.00 TB BW',
|
||||
[i.strip() for i in size_list]
|
||||
|
|
|
@ -111,7 +111,7 @@ class CloudTest(ShellCase):
|
|||
super(CloudTest, self).setUp()
|
||||
|
||||
if not self.PROVIDER:
|
||||
self.fail('A PROVIDER_NAME must be defined for this test')
|
||||
self.fail('A PROVIDER must be defined for this test')
|
||||
|
||||
# check if appropriate cloud provider and profile files are present
|
||||
if self.profile_str + ':' not in self.providers:
|
||||
|
@ -128,7 +128,7 @@ class CloudTest(ShellCase):
|
|||
|
||||
self.assertFalse(missing_conf_item, 'Conf items are missing that must be provided to run these tests: {}'
|
||||
.format(', '.join(missing_conf_item)) +
|
||||
'Check tests/integration/files/conf/cloud.providers.d/{0}.conf'.format(self.PROVIDER))
|
||||
'\nCheck tests/integration/files/conf/cloud.providers.d/{0}.conf'.format(self.PROVIDER))
|
||||
|
||||
self.assertFalse(self._instance_exists(),
|
||||
'The instance "{}" exists before it was created by the test'.format(self.instance_name))
|
||||
|
|
Loading…
Add table
Reference in a new issue