Convert result of hosts.values() to list always

In Python 3 dict.values() returns a dictionary view object
which don't support indexing.
Because of that some tests in
tempest.api.compute.admin.test_servers_on_multinodes module
were failing when running on python 3.

This patch fixes this issue by converting result of dict.values()
method to list always.

Change-Id: I5580dd7a6f22fbe880ea81b3e36b3d6111209958
This commit is contained in:
Slawek Kaplonski
2019-01-31 00:22:41 +01:00
parent 91d92424bc
commit ebc2186e7f

View File

@@ -105,7 +105,7 @@ class ServersOnMultiNodesTest(base.BaseV2ComputeAdminTest):
asserts the servers are in the group and on different hosts.
"""
hosts = self._create_servers_with_group('anti-affinity')
hostnames = hosts.values()
hostnames = list(hosts.values())
self.assertNotEqual(hostnames[0], hostnames[1],
'Servers are on the same host: %s' % hosts)
@@ -120,6 +120,6 @@ class ServersOnMultiNodesTest(base.BaseV2ComputeAdminTest):
asserts the servers are in the group and on same host.
"""
hosts = self._create_servers_with_group('affinity')
hostnames = hosts.values()
hostnames = list(hosts.values())
self.assertEqual(hostnames[0], hostnames[1],
'Servers are on the different hosts: %s' % hosts)