diff options
-rw-r--r-- | docker/smoke/Dockerfile | 2 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/rally/rally.py | 24 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/vmtp/vmtp.py | 2 | ||||
-rw-r--r-- | functest/tests/unit/openstack/rally/test_rally.py | 15 |
4 files changed, 7 insertions, 36 deletions
diff --git a/docker/smoke/Dockerfile b/docker/smoke/Dockerfile index 6a27759d3..1ed39bdc0 100644 --- a/docker/smoke/Dockerfile +++ b/docker/smoke/Dockerfile @@ -4,7 +4,7 @@ ARG BRANCH=master ARG OPENSTACK_TAG=stable/queens ARG REFSTACK_TARGET=2017.09 ARG PATROLE_TAG=0.3.0 -ARG VMTP_TAG=refs/changes/59/588459/1 +ARG VMTP_TAG=99b261ccccc2f8a08ee2d8fca9f54ef9d69899d7 RUN apk --no-cache add --update libxml2 libxslt && \ apk --no-cache add --virtual .build-deps --update \ diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index efee15aee..4a6362903 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -169,14 +169,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.""" black_tests = [] @@ -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) diff --git a/functest/opnfv_tests/openstack/vmtp/vmtp.py b/functest/opnfv_tests/openstack/vmtp/vmtp.py index aada034da..9e6fd8e15 100644 --- a/functest/opnfv_tests/openstack/vmtp/vmtp.py +++ b/functest/opnfv_tests/openstack/vmtp/vmtp.py @@ -58,7 +58,7 @@ class Vmtp(singlevm.VmReady2): (_, self.privkey_filename) = tempfile.mkstemp() (_, self.pubkey_filename) = tempfile.mkstemp() - def create_network_ressources(self): + def create_network_resources(self): """Create router It creates a router which gateway is the external network detected. diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py index b49fe627a..1a43e561d 100644 --- a/functest/tests/unit/openstack/rally/test_rally.py +++ b/functest/tests/unit/openstack/rally/test_rally.py @@ -104,12 +104,6 @@ class OSRallyTesting(unittest.TestCase): self.assertEqual(self.rally_base.task_succeed(json_raw), True) - def test_get_cmd_output(self): - proc = mock.Mock() - proc.stdout.__iter__ = mock.Mock(return_value=iter(['line1', 'line2'])) - self.assertEqual(self.rally_base.get_cmd_output(proc), - 'line1line2') - @mock.patch('six.moves.builtins.open', mock.mock_open()) @mock.patch('functest.opnfv_tests.openstack.rally.rally.yaml.safe_load', return_value={'scenario': [ @@ -222,8 +216,6 @@ class OSRallyTesting(unittest.TestCase): '_build_task_args', return_value={}) @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' 'get_task_id', return_value=None) - @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' - 'get_cmd_output', return_value='') @mock.patch('functest.opnfv_tests.openstack.rally.rally.os.path.exists', return_value=True) @mock.patch('functest.opnfv_tests.openstack.rally.rally.subprocess.Popen') @@ -232,7 +224,7 @@ class OSRallyTesting(unittest.TestCase): # pylint: disable=unused-argument with self.assertRaises(Exception): self.rally_base._run_task('test_name') - text = 'Failed to retrieve task_id, validating task...' + text = 'Failed to retrieve task_id' mock_logger_error.assert_any_call(text) @mock.patch('six.moves.builtins.open', mock.mock_open()) @@ -245,8 +237,6 @@ class OSRallyTesting(unittest.TestCase): @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' 'get_task_id', return_value='1') @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' - 'get_cmd_output', return_value='') - @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' 'task_succeed', return_value=True) @mock.patch('functest.opnfv_tests.openstack.rally.rally.os.path.exists', return_value=True) @@ -264,12 +254,9 @@ class OSRallyTesting(unittest.TestCase): @mock.patch('six.moves.builtins.open', mock.mock_open()) @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' 'task_succeed', return_value=True) - @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' - 'get_cmd_output', return_value='') @mock.patch('functest.opnfv_tests.openstack.rally.rally.os.path.exists', return_value=True) @mock.patch('subprocess.check_output') - @mock.patch('functest.opnfv_tests.openstack.rally.rally.subprocess.Popen') @mock.patch('functest.opnfv_tests.openstack.rally.rally.os.makedirs') @mock.patch('functest.opnfv_tests.openstack.rally.rally.LOGGER.info') @mock.patch('functest.opnfv_tests.openstack.rally.rally.LOGGER.debug') |