diff options
-rw-r--r-- | tempest/api/compute/admin/test_fixed_ips_negative.py | 5 | ||||
-rw-r--r-- | tempest/api/compute/images/test_images_oneserver.py | 6 | ||||
-rw-r--r-- | tempest/api/telemetry/test_telemetry_notification_api.py | 1 | ||||
-rw-r--r-- | tempest/cmd/cleanup.py | 1 | ||||
-rw-r--r-- | tempest/cmd/cleanup_service.py | 4 | ||||
-rwxr-xr-x | tempest/cmd/javelin.py | 10 | ||||
-rw-r--r-- | tempest/cmd/resources.yaml | 1 | ||||
-rwxr-xr-x | tempest/cmd/verify_tempest_config.py | 23 | ||||
-rw-r--r-- | tempest/scenario/manager.py | 14 | ||||
-rw-r--r-- | tempest/scenario/test_security_groups_basic_ops.py | 6 | ||||
-rw-r--r-- | tempest/services/identity/v3/json/identity_client.py | 7 | ||||
-rw-r--r-- | tempest/services/identity/v3/xml/identity_client.py | 7 | ||||
-rw-r--r-- | tempest/tests/cmd/test_verify_tempest_config.py | 18 |
13 files changed, 72 insertions, 31 deletions
diff --git a/tempest/api/compute/admin/test_fixed_ips_negative.py b/tempest/api/compute/admin/test_fixed_ips_negative.py index 90be8201b..8d6a7fcfb 100644 --- a/tempest/api/compute/admin/test_fixed_ips_negative.py +++ b/tempest/api/compute/admin/test_fixed_ips_negative.py @@ -68,7 +68,10 @@ class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest): # NOTE(maurosr): since this exercises the same code snippet, we do it # only for reserve action body = {"reserve": "None"} - self.assertRaises(exceptions.NotFound, + # NOTE(eliqiao): in Juno, the exception is NotFound, but in master, we + # change the error code to BadRequest, both exceptions should be + # accepted by tempest + self.assertRaises((exceptions.NotFound, exceptions.BadRequest), self.client.reserve_fixed_ip, "my.invalid.ip", body) diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py index c0b67305f..459d78b3f 100644 --- a/tempest/api/compute/images/test_images_oneserver.py +++ b/tempest/api/compute/images/test_images_oneserver.py @@ -105,7 +105,11 @@ class ImagesOneServerTestJSON(base.BaseV2ComputeTest): raise self.skipException("Not testable in XML") # prefix character is: # http://www.fileformat.info/info/unicode/char/1F4A9/index.htm - utf8_name = data_utils.rand_name(u'\xF0\x9F\x92\xA9') + + # We use a string with 3 byte utf-8 character due to bug + # #1370954 in glance which will 500 if mysql is used as the + # backend and it attempts to store a 4 byte utf-8 character + utf8_name = data_utils.rand_name('\xe2\x82\xa1') resp, body = self.client.create_image(self.server_id, utf8_name) image_id = data_utils.parse_image_id(resp['location']) self.addCleanup(self.client.delete_image, image_id) diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py index 3782b709e..42e2a2daa 100644 --- a/tempest/api/telemetry/test_telemetry_notification_api.py +++ b/tempest/api/telemetry/test_telemetry_notification_api.py @@ -32,7 +32,6 @@ class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest): @test.attr(type="gate") @testtools.skipIf(not CONF.service_available.nova, "Nova is not available.") - @test.skip_because(bug="1336755") def test_check_nova_notification(self): resp, body = self.create_server() diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py index 9ae3dfbfa..a305e4251 100644 --- a/tempest/cmd/cleanup.py +++ b/tempest/cmd/cleanup.py @@ -12,7 +12,6 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -# @author: David Paterson """ Utility for cleaning up environment after Tempest run diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py index f5f0db3f8..0d3c6c6e3 100644 --- a/tempest/cmd/cleanup_service.py +++ b/tempest/cmd/cleanup_service.py @@ -13,11 +13,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -''' -Created on Sep 3, 2014 -@author: David_Paterson -''' from tempest import config from tempest.openstack.common import log as logging from tempest import test diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py index 3c41dd997..0adc7e0ee 100755 --- a/tempest/cmd/javelin.py +++ b/tempest/cmd/javelin.py @@ -20,6 +20,7 @@ resources in a declarative way. """ import argparse +import collections import datetime import os import sys @@ -43,7 +44,7 @@ from tempest.services.volume.json import volumes_client OPTS = {} USERS = {} -RES = {} +RES = collections.defaultdict(list) LOG = None @@ -282,6 +283,8 @@ class JavelinCheck(unittest.TestCase): If in check mode confirm that the oldest sample available is from before the upgrade. """ + if not self.res.get('telemetry'): + return LOG.info("checking telemetry") for server in self.res['servers']: client = client_for_user(server['owner']) @@ -508,6 +511,9 @@ def _get_volume_by_name(client, name): def create_volumes(volumes): + if not volumes: + return + LOG.info("Creating volumes") for volume in volumes: client = client_for_user(volume['owner']) @@ -630,7 +636,7 @@ def main(): global RES get_options() setup_logging() - RES = load_resources(OPTS.resources) + RES.update(load_resources(OPTS.resources)) if OPTS.mode == 'create': create_resources() diff --git a/tempest/cmd/resources.yaml b/tempest/cmd/resources.yaml index 19ee6d595..2d5e68687 100644 --- a/tempest/cmd/resources.yaml +++ b/tempest/cmd/resources.yaml @@ -57,3 +57,4 @@ objects: name: javelin1 owner: javelin file: /etc/hosts +telemetry: true diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py index 5046bff46..f426e4d35 100755 --- a/tempest/cmd/verify_tempest_config.py +++ b/tempest/cmd/verify_tempest_config.py @@ -122,6 +122,18 @@ def verify_cinder_api_versions(os, update): not CONF.volume_feature_enabled.api_v2, update) +def verify_api_versions(os, service, update): + verify = { + 'cinder': verify_cinder_api_versions, + 'glance': verify_glance_api_versions, + 'keystone': verify_keystone_api_versions, + 'nova': verify_nova_api_versions, + } + if service not in verify: + return + verify[service](os, update) + + def get_extension_client(os, service): extensions_client = { 'nova': os.extensions_client, @@ -337,10 +349,13 @@ def main(): elif service not in services: continue results = verify_extensions(os, service, results) - verify_keystone_api_versions(os, update) - verify_glance_api_versions(os, update) - verify_nova_api_versions(os, update) - verify_cinder_api_versions(os, update) + + # Verify API verisons of all services in the keystone catalog and keystone + # itself. + services.append('keystone') + for service in services: + verify_api_versions(os, service, update) + display_results(results, update, replace) if update: conf_file.close() diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py index 79207cd93..baa718658 100644 --- a/tempest/scenario/manager.py +++ b/tempest/scenario/manager.py @@ -386,6 +386,12 @@ class ScenarioTest(tempest.test.BaseTestCase): LOG.debug(self.servers_client.get_console_output(server['id'], length=None)) + def _log_net_info(self, exc): + # network debug is called as part of ssh init + if not isinstance(exc, exceptions.SSHTimeout): + LOG.debug('Network information on a devstack host') + debug.log_net_debug() + def create_server_snapshot(self, server, name=None): # Glance client _image_client = self.image_client @@ -666,9 +672,7 @@ class NetworkScenarioTest(ScenarioTest): ex_msg += ": " + msg LOG.exception(ex_msg) self._log_console_output(servers) - # network debug is called as part of ssh init - if not isinstance(e, exceptions.SSHTimeout): - debug.log_net_debug() + self._log_net_info(e) raise def _check_tenant_network_connectivity(self, server, @@ -692,9 +696,7 @@ class NetworkScenarioTest(ScenarioTest): except Exception as e: LOG.exception('Tenant network connectivity check failed') self._log_console_output(servers_for_debug) - # network debug is called as part of ssh init - if not isinstance(e, exceptions.SSHTimeout): - debug.log_net_debug() + self._log_net_info(e) raise def _check_remote_connectivity(self, source, dest, should_succeed=True): diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py index 188dea849..6c360341f 100644 --- a/tempest/scenario/test_security_groups_basic_ops.py +++ b/tempest/scenario/test_security_groups_basic_ops.py @@ -241,7 +241,11 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): 'security_groups': security_groups, 'tenant_id': tenant.creds.tenant_id } - return self.create_server(name=name, create_kwargs=create_kwargs) + server = self.create_server(name=name, create_kwargs=create_kwargs) + self.assertEqual( + sorted([s['name'] for s in security_groups]), + sorted([s['name'] for s in server['security_groups']])) + return server def _create_tenant_servers(self, tenant, num=1): for i in range(num): diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py index df424ca54..5ad416cc0 100644 --- a/tempest/services/identity/v3/json/identity_client.py +++ b/tempest/services/identity/v3/json/identity_client.py @@ -31,14 +31,11 @@ class IdentityV3ClientJSON(rest_client.RestClient): self.endpoint_url = 'adminURL' self.api_version = "v3" - def create_user(self, user_name, **kwargs): + def create_user(self, user_name, password=None, project_id=None, + email=None, domain_id='default', **kwargs): """Creates a user.""" - password = kwargs.get('password', None) - email = kwargs.get('email', None) en = kwargs.get('enabled', True) - project_id = kwargs.get('project_id', None) description = kwargs.get('description', None) - domain_id = kwargs.get('domain_id', 'default') post_body = { 'project_id': project_id, 'description': description, diff --git a/tempest/services/identity/v3/xml/identity_client.py b/tempest/services/identity/v3/xml/identity_client.py index 5c436929f..fdc0a0aef 100644 --- a/tempest/services/identity/v3/xml/identity_client.py +++ b/tempest/services/identity/v3/xml/identity_client.py @@ -95,14 +95,11 @@ class IdentityV3ClientXML(rest_client.RestClient): _json = common.xml_to_json(body) return _json - def create_user(self, user_name, **kwargs): + def create_user(self, user_name, password=None, project_id=None, + email=None, domain_id='default', **kwargs): """Creates a user.""" - password = kwargs.get('password', None) - email = kwargs.get('email', None) en = kwargs.get('enabled', 'true') - project_id = kwargs.get('project_id', None) description = kwargs.get('description', None) - domain_id = kwargs.get('domain_id', 'default') post_body = common.Element("user", xmlns=XMLNS, name=user_name, diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py index a28684e3c..6679c7916 100644 --- a/tempest/tests/cmd/test_verify_tempest_config.py +++ b/tempest/tests/cmd/test_verify_tempest_config.py @@ -86,6 +86,24 @@ class TestDiscovery(base.TestCase): self.assertIn('v2.0', versions) self.assertIn('v3.0', versions) + def test_verify_api_versions(self): + api_services = ['cinder', 'glance', 'keystone', 'nova'] + fake_os = mock.MagicMock() + for svc in api_services: + m = 'verify_%s_api_versions' % svc + with mock.patch.object(verify_tempest_config, m) as verify_mock: + verify_tempest_config.verify_api_versions(fake_os, svc, True) + verify_mock.assert_called_once_with(fake_os, True) + + def test_verify_api_versions_not_implemented(self): + api_services = ['cinder', 'glance', 'keystone', 'nova'] + fake_os = mock.MagicMock() + for svc in api_services: + m = 'verify_%s_api_versions' % svc + with mock.patch.object(verify_tempest_config, m) as verify_mock: + verify_tempest_config.verify_api_versions(fake_os, 'foo', True) + self.assertFalse(verify_mock.called) + def test_verify_keystone_api_versions_no_v3(self): self.useFixture(mockpatch.PatchObject( verify_tempest_config, '_get_unversioned_endpoint', |