diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-03-17 21:44:44 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-03-17 21:54:07 +0100 |
commit | 78c0b09a2cf3a57ae5d4f8cfe67ab66ad9d8aef2 (patch) | |
tree | a3647c8149aeaa19932696dd41ffa0383846b01e /functest/opnfv_tests | |
parent | 82bb54e41ab0f8365ca5e1e6469860287d089a1c (diff) |
Mute all rally messages
The are now printed in functest.log only.
JIRA: FUNCTEST-950
Change-Id: I1fdd0e0f1be19fc5e7536326acb6a66645610696
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/opnfv_tests')
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/conf_utils.py | 64 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 11 |
2 files changed, 36 insertions, 39 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index 0ff68f292..e0a36e5a4 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -22,7 +22,6 @@ import yaml from functest.utils import config from functest.utils import env -import functest.utils.functest_utils as ft_utils IMAGE_ID_ALT = None @@ -64,35 +63,40 @@ def create_rally_deployment(): LOGGER.info("Creating Rally environment...") - cmd = "rally deployment destroy opnfv-rally" - ft_utils.execute_command(cmd, error_msg=( - "Deployment %s does not exist." - % getattr(config.CONF, 'rally_deployment_name')), verbose=False) + try: + cmd = ['rally', 'deployment', 'destroy', + '--deployment', + str(getattr(config.CONF, 'rally_deployment_name'))] + output = subprocess.check_output(cmd) + LOGGER.info("%s\n%s", " ".join(cmd), output) + except subprocess.CalledProcessError: + pass - cmd = ("rally deployment create --fromenv --name={0}" - .format(getattr(config.CONF, 'rally_deployment_name'))) - error_msg = "Problem while creating Rally deployment" - ft_utils.execute_command_raise(cmd, error_msg=error_msg) + cmd = ['rally', 'deployment', 'create', '--fromenv', + '--name', str(getattr(config.CONF, 'rally_deployment_name'))] + output = subprocess.check_output(cmd) + LOGGER.info("%s\n%s", " ".join(cmd), output) - cmd = "rally deployment check" - error_msg = "OpenStack not responding or faulty Rally deployment." - ft_utils.execute_command_raise(cmd, error_msg=error_msg) + cmd = ['rally', 'deployment', 'check'] + output = subprocess.check_output(cmd) + LOGGER.info("%s\n%s", " ".join(cmd), output) def create_verifier(): """Create new verifier""" LOGGER.info("Create verifier from existing repo...") - cmd = ("rally verify delete-verifier --id '{0}' --force").format( - getattr(config.CONF, 'tempest_verifier_name')) - ft_utils.execute_command(cmd, error_msg=( - "Verifier %s does not exist." - % getattr(config.CONF, 'tempest_verifier_name')), verbose=False) - cmd = ("rally verify create-verifier --source {0} " - "--name {1} --type tempest --system-wide" - .format(getattr(config.CONF, 'dir_repo_tempest'), - getattr(config.CONF, 'tempest_verifier_name'))) - ft_utils.execute_command_raise(cmd, - error_msg='Problem while creating verifier') + cmd = ['rally', 'verify', 'delete-verifier', + '--id', str(getattr(config.CONF, 'tempest_verifier_name')), + '--force'] + output = subprocess.check_output(cmd) + LOGGER.info("%s\n%s", " ".join(cmd), output) + + cmd = ['rally', 'verify', 'create-verifier', + '--source', str(getattr(config.CONF, 'dir_repo_tempest')), + '--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) def get_verifier_id(): @@ -253,17 +257,13 @@ def configure_verifier(deployment_dir): """ Execute rally verify configure-verifier, which generates tempest.conf """ - tempest_conf_file = os.path.join(deployment_dir, "tempest.conf") - if os.path.isfile(tempest_conf_file): - LOGGER.debug("Verifier is already configured.") - LOGGER.debug("Reconfiguring the current verifier...") - cmd = "rally verify configure-verifier --reconfigure" - else: - LOGGER.info("Configuring the verifier...") - cmd = "rally verify configure-verifier" - ft_utils.execute_command(cmd) + 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) LOGGER.debug("Looking for tempest.conf file...") + tempest_conf_file = os.path.join(deployment_dir, "tempest.conf") if not os.path.isfile(tempest_conf_file): LOGGER.error("Tempest configuration file %s NOT found.", tempest_conf_file) diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index c11262e02..cab09a641 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -34,7 +34,6 @@ from functest.opnfv_tests.openstack.snaps import snaps_utils from functest.opnfv_tests.openstack.tempest import conf_utils from functest.utils import config from functest.utils import env -from functest.utils import functest_utils LOGGER = logging.getLogger(__name__) @@ -115,12 +114,10 @@ class TempestCommon(testcase.TestCase): testr_mode = r"'^tempest\.'" else: testr_mode = self.mode - cmd = ("cd {0};" - "testr list-tests {1} > {2};" - "cd -;".format(self.verifier_repo_dir, - testr_mode, - self.list)) - functest_utils.execute_command(cmd) + cmd = "(cd {0}; testr list-tests {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) def apply_tempest_blacklist(self): """Exclude blacklisted test cases.""" |