Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ensure extension aliases are used for nova based services
This commit fixes the extension checker in verify-tempest-config to
ensure that nova and nova based services are using the extension
aliases instead of the extension names. The extension names are meant
to be human readable and are not the best way to identify it. This is
what the tempest code is also expecting, however in some cases the
name was still being used by the verify tool, which was incorrect. As
part of this it was necessary to fix several other places where name
was being used instead of alias, or other extension list formatting
response checking was incorrect.

Change-Id: I35f5db655f065f29760515a26db1fb508d229393
  • Loading branch information
mtreinish committed Dec 9, 2014
1 parent 6e228dc commit 54176ce
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
4 changes: 2 additions & 2 deletions tempest/api/compute/test_extensions.py
Expand Up @@ -38,11 +38,11 @@ def test_list_extensions(self):
if ext == 'all':
self.assertIn('Hosts', map(lambda x: x['name'], extensions))
elif ext:
self.assertIn(ext, map(lambda x: x['name'], extensions))
self.assertIn(ext, map(lambda x: x['alias'], extensions))
else:
raise self.skipException('There are not any extensions configured')
# Log extensions list
extension_list = map(lambda x: x['name'], extensions)
extension_list = map(lambda x: x['alias'], extensions)
LOG.debug("Nova extensions: %s" % ','.join(extension_list))

@test.requires_ext(extension='os-consoles', service='compute')
Expand Down
2 changes: 1 addition & 1 deletion tempest/api/volume/test_extensions.py
Expand Up @@ -39,7 +39,7 @@ def test_list_extensions(self):
if ext == 'all':
self.assertIn('Hosts', map(lambda x: x['name'], extensions))
elif ext:
self.assertIn(ext, map(lambda x: x['name'], extensions))
self.assertIn(ext, map(lambda x: x['alias'], extensions))
else:
raise self.skipException('There are not any extensions configured')

Expand Down
14 changes: 6 additions & 8 deletions tempest/cmd/verify_tempest_config.py
Expand Up @@ -165,21 +165,19 @@ def get_enabled_extensions(service):
def verify_extensions(os, service, results):
extensions_client = get_extension_client(os, service)
__, resp = extensions_client.list_extensions()
# For Nova, Cinder and Neutron we use the alias name rather than the
# 'name' field because the alias is considered to be the canonical
# name.
if isinstance(resp, dict):
# For both Nova and Neutron we use the alias name rather than the
# 'name' field because the alias is considered to be the canonical
# name.
if service in ['nova', 'nova_v3', 'neutron']:
extensions = map(lambda x: x['alias'], resp['extensions'])
elif service == 'swift':
if service == 'swift':
# Remove Swift general information from extensions list
resp.pop('swift')
extensions = resp.keys()
else:
extensions = map(lambda x: x['name'], resp['extensions'])
extensions = map(lambda x: x['alias'], resp['extensions'])

else:
extensions = map(lambda x: x['name'], resp)
extensions = map(lambda x: x['alias'], resp)
if not results.get(service):
results[service] = {}
extensions_opt = get_enabled_extensions(service)
Expand Down
23 changes: 11 additions & 12 deletions tempest/tests/cmd/test_verify_tempest_config.py
Expand Up @@ -261,9 +261,9 @@ def fake_list_extensions():

def test_verify_extensions_cinder(self):
def fake_list_extensions():
return (None, {'extensions': [{'name': 'fake1'},
{'name': 'fake2'},
{'name': 'not_fake'}]})
return (None, {'extensions': [{'alias': 'fake1'},
{'alias': 'fake2'},
{'alias': 'not_fake'}]})
fake_os = mock.MagicMock()
fake_os.volumes_extension_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
Expand All @@ -283,9 +283,9 @@ def fake_list_extensions():

def test_verify_extensions_cinder_all(self):
def fake_list_extensions():
return (None, {'extensions': [{'name': 'fake1'},
{'name': 'fake2'},
{'name': 'not_fake'}]})
return (None, {'extensions': [{'alias': 'fake1'},
{'alias': 'fake2'},
{'alias': 'not_fake'}]})
fake_os = mock.MagicMock()
fake_os.volumes_extension_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
Expand All @@ -300,9 +300,8 @@ def fake_list_extensions():

def test_verify_extensions_nova(self):
def fake_list_extensions():
return (None, {'extensions': [{'alias': 'fake1'},
{'alias': 'fake2'},
{'alias': 'not_fake'}]})
return (None, [{'alias': 'fake1'}, {'alias': 'fake2'},
{'alias': 'not_fake'}])
fake_os = mock.MagicMock()
fake_os.extensions_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
Expand Down Expand Up @@ -339,9 +338,9 @@ def fake_list_extensions():

def test_verify_extensions_nova_v3(self):
def fake_list_extensions():
return (None, {'extensions': [{'alias': 'fake1'},
{'alias': 'fake2'},
{'alias': 'not_fake'}]})
return (None, [{'alias': 'fake1'},
{'alias': 'fake2'},
{'alias': 'not_fake'}])
fake_os = mock.MagicMock()
fake_os.extensions_v3_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
Expand Down

0 comments on commit 54176ce

Please sign in to comment.