diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2019-05-25 09:38:40 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2019-05-25 11:24:42 +0200 |
commit | 0e19012c4f11cc09c323476511893bbf3893a508 (patch) | |
tree | 288971a8bdf0eac310b9bc95834de08930886409 /functest/opnfv_tests/openstack/rally | |
parent | 4b102db86a426d0b56168cb7621e9baa42aeb93b (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>
(cherry picked from commit 5853dd1ef3c522a975f9685250b1b3e85588f738)
Diffstat (limited to 'functest/opnfv_tests/openstack/rally')
-rw-r--r-- | functest/opnfv_tests/openstack/rally/rally.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 08e4a36c1..6dfdabec8 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -166,7 +166,7 @@ class RallyBase(singlevm.VmReady2): stdout=subprocess.PIPE, stderr=subprocess.STDOUT) deployment_uuid = proc.stdout.readline().rstrip() - return deployment_uuid.decode() + return deployment_uuid.decode("utf-8") @staticmethod def create_rally_deployment(environ=None): @@ -191,18 +191,18 @@ class RallyBase(singlevm.VmReady2): '--deployment', str(getattr(config.CONF, 'rally_deployment_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")) except subprocess.CalledProcessError: pass cmd = ['rally', 'deployment', 'create', '--fromenv', '--name', str(getattr(config.CONF, 'rally_deployment_name'))] output = subprocess.check_output(cmd, env=environ) - LOGGER.info("%s\n%s", " ".join(cmd), output.decode()) + LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) cmd = ['rally', 'deployment', 'check'] 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 RallyBase.get_verifier_deployment_id() @staticmethod @@ -240,7 +240,7 @@ class RallyBase(singlevm.VmReady2): taskid_re = re.compile('^Task +(.*): started$') for line in cmd_raw.splitlines(True): line = line.strip() - match = taskid_re.match(line.decode()) + match = taskid_re.match(line.decode("utf-8")) if match: return match.group(1) return None @@ -399,7 +399,7 @@ class RallyBase(singlevm.VmReady2): cmd = (["rally", "task", "detailed", "--uuid", task_id]) LOGGER.debug('running command: %s', cmd) output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - LOGGER.info("%s\n%s", " ".join(cmd), output.decode()) + LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) # save report as JSON report_json_name = '{}.json'.format(test_name) @@ -408,7 +408,7 @@ class RallyBase(singlevm.VmReady2): "--out", report_json_dir]) LOGGER.debug('running command: %s', cmd) output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - LOGGER.info("%s\n%s", " ".join(cmd), output.decode()) + LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) json_results = open(report_json_dir).read() self._append_summary(json_results, test_name) @@ -608,7 +608,7 @@ class RallyBase(singlevm.VmReady2): "--to", file_name] LOGGER.debug('running command: %s', cmd) output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - LOGGER.info("%s\n%s", " ".join(cmd), output.decode()) + LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) @staticmethod def verify_report(file_name, uuid, export_type="html"): @@ -624,7 +624,7 @@ class RallyBase(singlevm.VmReady2): "--uuid", uuid, "--to", file_name] LOGGER.debug('running command: %s', cmd) output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - LOGGER.info("%s\n%s", " ".join(cmd), output.decode()) + LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) def clean(self): """Cleanup of OpenStack resources. Should be called on completion.""" |