X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Fopnfv_tests%2Fopenstack%2Frally%2Frally.py;h=4a63629032a0cbb2e77f8e1581f5503a48935ad2;hb=e329a356a6324b9bdc1ef928a0f8d6ce9aa78616;hp=1a2115ccdc1a3df40e2ea304ffae73d7653631a2;hpb=18c96abe8b6a3d6e919ff7ba64952454830357b3;p=functest.git diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 1a2115ccd..4a6362903 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -168,14 +168,6 @@ class RallyBase(singlevm.VmReady1): return False - @staticmethod - def get_cmd_output(proc): - """Get command stdout.""" - result = "" - for line in proc.stdout: - result += line - return result - @staticmethod def excl_scenario(): """Exclude scenario.""" @@ -345,23 +337,15 @@ class RallyBase(singlevm.VmReady1): task_file, "--task-args", str(self._build_task_args(test_name))]) LOGGER.debug('running command: %s', cmd) - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - output = self.get_cmd_output(proc) - task_id = self.get_task_id(output) + output = proc.communicate()[0] + task_id = self.get_task_id(output) LOGGER.debug('task_id : %s', task_id) - if task_id is None: - LOGGER.error('Failed to retrieve task_id, validating task...') - cmd = (["rally", "task", "validate", "--task", task_file, - "--task-args", str(self._build_task_args(test_name))]) - LOGGER.debug('running command: %s', cmd) - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - output = self.get_cmd_output(proc) - LOGGER.error("Task validation result:" + "\n" + output) + LOGGER.error("Failed to retrieve task_id") + LOGGER.error("Result:\n%s", output) raise Exception("Failed to retrieve task id") self._save_results(test_name, task_id) @@ -473,9 +457,9 @@ class RallyBase(singlevm.VmReady1): def clean(self): """Cleanup of OpenStack resources. Should be called on completion.""" - super(RallyBase, self).clean() if self.flavor_alt: self.orig_cloud.delete_flavor(self.flavor_alt.id) + super(RallyBase, self).clean() def is_successful(self): """The overall result of the test."""