aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/tempest
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2019-05-25 09:38:40 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2019-05-25 11:23:45 +0200
commit5853dd1ef3c522a975f9685250b1b3e85588f738 (patch)
treedb375cd93716df8cd27cff410183af0c37c0833e /functest/opnfv_tests/openstack/tempest
parent7d58f89103a8c44fd166c3e06b492ade63e5c5b3 (diff)
Set utf-8 in decode and encode calls
It eases backporting in iruya and hunter as a few logs can't be decoded as ascii [1]. [1] https://build.opnfv.org/ci/job/functest-opnfv-functest-vnf-iruya-juju_epc-run/56/console Change-Id: I52a6f9a25130cbf62e8ce3b9972064ab73177665 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/opnfv_tests/openstack/tempest')
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index 69f7c2958..831f732d1 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -142,8 +142,8 @@ class TempestCommon(singlevm.VmReady2):
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
for line in proc.stdout:
- LOGGER.info(line.decode().rstrip())
- new_line = line.decode().replace(' ', '').split('|')
+ LOGGER.info(line.decode("utf-8").rstrip())
+ new_line = line.decode("utf-8").replace(' ', '').split('|')
if 'Tests' in new_line:
break
if 'Testscount' in new_line:
@@ -175,7 +175,7 @@ class TempestCommon(singlevm.VmReady2):
'--force']
try:
output = subprocess.check_output(cmd)
- LOGGER.info("%s\n%s", " ".join(cmd), output.decode())
+ LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8"))
except subprocess.CalledProcessError:
pass
@@ -184,7 +184,7 @@ class TempestCommon(singlevm.VmReady2):
'--name', str(getattr(config.CONF, 'tempest_verifier_name')),
'--type', 'tempest', '--system-wide']
output = subprocess.check_output(cmd)
- LOGGER.info("%s\n%s", " ".join(cmd), output.decode())
+ LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8"))
return TempestCommon.get_verifier_id()
@staticmethod
@@ -199,7 +199,7 @@ class TempestCommon(singlevm.VmReady2):
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
verifier_uuid = proc.stdout.readline().rstrip()
- return verifier_uuid.decode()
+ return verifier_uuid.decode("utf-8")
@staticmethod
def get_verifier_repo_dir(verifier_id):
@@ -320,7 +320,7 @@ class TempestCommon(singlevm.VmReady2):
cmd = ['rally', 'verify', 'configure-verifier', '--reconfigure',
'--id', str(getattr(config.CONF, 'tempest_verifier_name'))]
output = subprocess.check_output(cmd)
- LOGGER.info("%s\n%s", " ".join(cmd), output.decode())
+ LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8"))
LOGGER.debug("Looking for tempest.conf file...")
tempest_conf_file = os.path.join(deployment_dir, "tempest.conf")
@@ -347,7 +347,7 @@ class TempestCommon(singlevm.VmReady2):
cmd = "(cd {0}; stestr list '{1}' >{2} 2>/dev/null)".format(
self.verifier_repo_dir, testr_mode, self.list)
output = subprocess.check_output(cmd, shell=True)
- LOGGER.info("%s\n%s", cmd, output.decode())
+ LOGGER.info("%s\n%s", cmd, output.decode("utf-8"))
os.remove('/etc/tempest.conf')
def apply_tempest_blacklist(self):
@@ -403,12 +403,12 @@ class TempestCommon(singlevm.VmReady2):
with proc.stdout:
for line in iter(proc.stdout.readline, b''):
- if re.search(r"\} tempest\.", line.decode()):
+ if re.search(r"\} tempest\.", line.decode("utf-8")):
LOGGER.info(line.rstrip())
- elif re.search(r'(?=\(UUID=(.*)\))', line.decode()):
+ elif re.search(r'(?=\(UUID=(.*)\))', line.decode("utf-8")):
self.verification_id = re.search(
- r'(?=\(UUID=(.*)\))', line.decode()).group(1)
- f_stdout.write(line.decode())
+ r'(?=\(UUID=(.*)\))', line.decode("utf-8")).group(1)
+ f_stdout.write(line.decode("utf-8"))
proc.wait()
f_stdout.close()