Merge "make tempest work under py3"
This commit is contained in:
commit
2b3b7ccee0
vitrage_tempest_tests/tests
@ -17,6 +17,7 @@ import traceback
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslotest import base
|
||||
from six.moves import filter
|
||||
|
||||
from vitrage.common.constants import EdgeProperties
|
||||
from vitrage.common.constants import EntityCategory
|
||||
@ -78,7 +79,7 @@ class BaseApiTest(base.BaseTestCase):
|
||||
count = 0
|
||||
|
||||
while count < 40:
|
||||
LOG.info("wait_for_client - " + client_func.func_name)
|
||||
LOG.info("wait_for_client - " + client_func.__name__)
|
||||
client = client_func(conf)
|
||||
if client:
|
||||
return client
|
||||
@ -126,7 +127,7 @@ class BaseApiTest(base.BaseTestCase):
|
||||
host = filter(
|
||||
lambda item: item[VProps.VITRAGE_TYPE] == NOVA_HOST_DATASOURCE,
|
||||
topology['nodes'])
|
||||
return host[0]
|
||||
return next(host)
|
||||
|
||||
def _create_instances(self, num_instances, set_public_network=False):
|
||||
kwargs = {}
|
||||
@ -377,9 +378,10 @@ class BaseApiTest(base.BaseTestCase):
|
||||
public_nets = filter(
|
||||
lambda item: self._get_value(item, VProps.NAME) == 'public',
|
||||
networks['networks'])
|
||||
if not public_nets:
|
||||
try:
|
||||
return next(public_nets)
|
||||
except StopIteration:
|
||||
return None
|
||||
return public_nets[0]
|
||||
|
||||
def _print_entity_graph(self):
|
||||
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
||||
|
@ -67,14 +67,14 @@ class TestStaticPhysical(BaseApiTest):
|
||||
|
||||
# template file
|
||||
file_path = '/etc/vitrage/static_physical_configuration.yaml'
|
||||
with open(file_path, 'rb') as f:
|
||||
with open(file_path, 'r') as f:
|
||||
template_data = f.read()
|
||||
template_data = template_data.replace('tmp-devstack', hostname)
|
||||
|
||||
# new file
|
||||
new_file = open(
|
||||
'/etc/vitrage/static_datasources/'
|
||||
'static_physical_configuration.yaml', 'wb')
|
||||
'static_physical_configuration.yaml', 'w')
|
||||
new_file.write(template_data)
|
||||
new_file.close()
|
||||
|
||||
|
@ -73,7 +73,7 @@ def run_vitrage_command(command, conf):
|
||||
LOG.error('error from command %(command)s = %(error)s',
|
||||
{'error': stderr, 'command': full_command})
|
||||
|
||||
return stdout
|
||||
return stdout.decode('utf-8')
|
||||
|
||||
|
||||
def get_property_value(environment_name, conf_name, default_value, conf):
|
||||
@ -120,7 +120,7 @@ def uni2str(text):
|
||||
|
||||
|
||||
def tempest_logger(func):
|
||||
func_name = func.func_name
|
||||
func_name = func.__name__
|
||||
|
||||
@wraps(func)
|
||||
def func_name_print_func(*args, **kwargs):
|
||||
|
Loading…
x
Reference in New Issue
Block a user