Merge "L3 Agent Scheduler testcase cleanups"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index fae24c4..175f0d9 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -667,7 +667,7 @@
#non_ssh_image_regex = ^.*[Ww]in.*$
# List of user mapped to regex to matching image names. (string value)
-#ssh_user_regex = [["^.*[Cc]irros.*$", "root"]]
+#ssh_user_regex = [["^.*[Cc]irros.*$", "cirros"]]
[messaging]
diff --git a/tempest/api/compute/test_live_block_migration.py b/tempest/api/compute/admin/test_live_migration.py
similarity index 100%
rename from tempest/api/compute/test_live_block_migration.py
rename to tempest/api/compute/admin/test_live_migration.py
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
index c6d379c..5af9187 100644
--- a/tempest/api/identity/admin/v3/test_domains.py
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -96,3 +96,15 @@
self.assertEqual(d_name, domain['name'])
self.assertFalse(domain['enabled'])
self.assertEqual(d_desc, domain['description'])
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('2abf8764-309a-4fa9-bc58-201b799817ad')
+ def test_create_domain_without_description(self):
+ # Create domain only with name
+ d_name = data_utils.rand_name('domain-')
+ domain = self.client.create_domain(d_name)
+ self.addCleanup(self._delete_domain, domain['id'])
+ self.assertIn('id', domain)
+ expected_data = {'name': d_name, 'enabled': True}
+ self.assertIsNone(domain['description'])
+ self.assertDictContainsSubset(expected_data, domain)
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index e970249..05aaabe 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -992,9 +992,13 @@
add_router_interface(RES['routers'])
create_secgroups(RES['secgroups'])
- create_servers(RES['servers'])
create_volumes(RES['volumes'])
- attach_volumes(RES['volumes'])
+
+ # Only attempt attaching the volumes if servers are defined in the
+ # resourcefile
+ if 'servers' in RES:
+ create_servers(RES['servers'])
+ attach_volumes(RES['volumes'])
def destroy_resources():
diff --git a/tempest/common/accounts.py b/tempest/common/accounts.py
index fc8e6a5..6d376d6 100644
--- a/tempest/common/accounts.py
+++ b/tempest/common/accounts.py
@@ -38,7 +38,8 @@
def __init__(self, identity_version=None, name=None):
super(Accounts, self).__init__(identity_version=identity_version,
name=name)
- if os.path.isfile(CONF.auth.test_accounts_file):
+ if (CONF.auth.test_accounts_file and
+ os.path.isfile(CONF.auth.test_accounts_file)):
accounts = read_accounts_yaml(CONF.auth.test_accounts_file)
self.use_default_creds = False
else:
diff --git a/tempest/common/credentials.py b/tempest/common/credentials.py
index f3ddab9..c34df48 100644
--- a/tempest/common/credentials.py
+++ b/tempest/common/credentials.py
@@ -38,7 +38,8 @@
network_resources=network_resources,
identity_version=identity_version)
else:
- if os.path.isfile(CONF.auth.test_accounts_file):
+ if (CONF.auth.test_accounts_file and
+ os.path.isfile(CONF.auth.test_accounts_file)):
# Most params are not relevant for pre-created accounts
return accounts.Accounts(name=name,
identity_version=identity_version)
@@ -56,7 +57,8 @@
if CONF.auth.allow_tenant_isolation:
return is_admin
# Check whether test accounts file has the admin specified or not
- elif os.path.isfile(CONF.auth.test_accounts_file):
+ elif (CONF.auth.test_accounts_file and
+ os.path.isfile(CONF.auth.test_accounts_file)):
check_accounts = accounts.Accounts(name='check_admin')
if not check_accounts.admin_available():
is_admin = False
diff --git a/tempest/common/fixed_network.py b/tempest/common/fixed_network.py
index b06ddf2..b533898 100644
--- a/tempest/common/fixed_network.py
+++ b/tempest/common/fixed_network.py
@@ -15,6 +15,7 @@
from tempest_lib import exceptions as lib_exc
+from tempest.common import isolated_creds
from tempest import config
from tempest import exceptions
@@ -38,7 +39,7 @@
network = None
# NOTE(andreaf) get_primary_network will always be available once
# bp test-accounts-continued is implemented
- if (CONF.auth.allow_tenant_isolation and
+ if (isinstance(creds_provider, isolated_creds.IsolatedCreds) and
(CONF.service_available.neutron and
not CONF.service_available.ironic)):
network = creds_provider.get_primary_network()
diff --git a/tempest/config.py b/tempest/config.py
index 9577f2d..bd7ffb7 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -995,7 +995,7 @@
help="SSH verification in tests is skipped"
"for matching images"),
cfg.StrOpt('ssh_user_regex',
- default="[[\"^.*[Cc]irros.*$\", \"root\"]]",
+ default="[[\"^.*[Cc]irros.*$\", \"cirros\"]]",
help="List of user mapped to regex "
"to matching image names."),
]
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index bae8296..59d759d 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -680,6 +680,8 @@
def _get_network_by_name(self, network_name):
net = self._list_networks(name=network_name)
+ self.assertNotEqual(len(net), 0,
+ "Unable to get network by name: %s" % network_name)
return net_resources.AttributeDict(net[0])
def create_floating_ip(self, thing, external_network_id=None,
@@ -1049,6 +1051,9 @@
# not (the current baremetal case). Likely can be removed when
# test account mgmt is reworked:
# https://blueprints.launchpad.net/tempest/+spec/test-accounts
+ if not CONF.compute.fixed_network_name:
+ m = 'fixed_network_name must be specified in config'
+ raise exceptions.InvalidConfiguration(m)
network = self._get_network_by_name(
CONF.compute.fixed_network_name)
router = None
diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py
index e84d627..62e60d6 100644
--- a/tempest/stress/driver.py
+++ b/tempest/stress/driver.py
@@ -23,7 +23,7 @@
from tempest_lib.common.utils import data_utils
from tempest import clients
-from tempest.common import cred_provider
+from tempest.common import isolated_creds
from tempest.common import ssh
from tempest import config
from tempest import exceptions
@@ -149,15 +149,22 @@
username = data_utils.rand_name("stress_user")
tenant_name = data_utils.rand_name("stress_tenant")
password = "pass"
- identity_client = admin_manager.identity_client
- tenant = identity_client.create_tenant(name=tenant_name)
- identity_client.create_user(username,
- password,
- tenant['id'],
- "email")
- creds = cred_provider.get_credentials(username=username,
- password=password,
- tenant_name=tenant_name)
+ if CONF.identity.auth_version == 'v2':
+ identity_client = admin_manager.identity_client
+ else:
+ identity_client = admin_manager.identity_v3_client
+ credentials_client = isolated_creds.get_creds_client(
+ identity_client)
+ project = credentials_client.create_project(
+ name=tenant_name, description=tenant_name)
+ user = credentials_client.create_user(username, password,
+ project['id'], "email")
+ # Add roles specified in config file
+ for conf_role in CONF.auth.tempest_roles:
+ credentials_client.assign_user_role(user, project,
+ conf_role)
+ creds = credentials_client.get_credentials(user, project,
+ password)
manager = clients.Manager(credentials=creds)
test_obj = importutils.import_class(test['action'])
diff --git a/tempest/tests/common/test_accounts.py b/tempest/tests/common/test_accounts.py
index 0f8fa92..6371e49 100644
--- a/tempest/tests/common/test_accounts.py
+++ b/tempest/tests/common/test_accounts.py
@@ -67,7 +67,7 @@
self.useFixture(mockpatch.Patch(
'tempest.common.accounts.read_accounts_yaml',
return_value=self.test_accounts))
- cfg.CONF.set_default('test_accounts_file', '', group='auth')
+ cfg.CONF.set_default('test_accounts_file', 'fake_path', group='auth')
self.useFixture(mockpatch.Patch('os.path.isfile', return_value=True))
def _get_hash_list(self, accounts_list):
diff --git a/tempest/tests/common/test_admin_available.py b/tempest/tests/common/test_admin_available.py
index 5070f22..4e3aa4c 100644
--- a/tempest/tests/common/test_admin_available.py
+++ b/tempest/tests/common/test_admin_available.py
@@ -52,6 +52,8 @@
self.useFixture(mockpatch.Patch(
'tempest.common.accounts.read_accounts_yaml',
return_value=accounts))
+ cfg.CONF.set_default('test_accounts_file',
+ use_accounts_file, group='auth')
self.useFixture(mockpatch.Patch('os.path.isfile',
return_value=True))
else:
diff --git a/tools/check_uuid.py b/tools/check_uuid.py
index 34effe4..e21c3d8 100755
--- a/tools/check_uuid.py
+++ b/tools/check_uuid.py
@@ -275,7 +275,7 @@
if not test_uuid:
return
if test_uuid in uuids:
- error_str = "%s:%s\n uuid %s collision: %s<->%s\n%s:%s\n" % (
+ error_str = "%s:%s\n uuid %s collision: %s<->%s\n%s:%s" % (
tests[module_name]['source_path'],
tests[module_name]['tests'][test_name].lineno,
test_uuid,
@@ -285,6 +285,8 @@
uuids[test_uuid]['test_node'].lineno,
)
print(error_str)
+ print("cannot automatically resolve the collision, please "
+ "manually remove the duplicate value on the new test.")
return True
else:
uuids[test_uuid] = {