From bcde99e21f704355a3d03ab98ceace451a0436fc Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Sat, 28 May 2016 22:18:45 +0800 Subject: Bugfix: can not find tempest.log JIRA: FUNCTEST-269 Remove dependency on CI_DEBUG and use subprocess.call to redirect stdout to tempest.log in any case. Change-Id: Ibac68bec7f98007d24def25fd609051b5c528fc7 Signed-off-by: SerenaFeng --- testcases/OpenStack/tempest/run_tempest.py | 45 ++++++++++++++---------------- 1 file changed, 21 insertions(+), 24 deletions(-) (limited to 'testcases/OpenStack/tempest') diff --git a/testcases/OpenStack/tempest/run_tempest.py b/testcases/OpenStack/tempest/run_tempest.py index 93581f0a9..f77332137 100644 --- a/testcases/OpenStack/tempest/run_tempest.py +++ b/testcases/OpenStack/tempest/run_tempest.py @@ -256,30 +256,27 @@ def run_tempest(OPTION): cmd_line = "rally verify start " + OPTION + " --system-wide" CI_DEBUG = os.environ.get("CI_DEBUG") - if CI_DEBUG == "true" or CI_DEBUG == "True": - ft_utils.execute_command(cmd_line, logger, exit_on_error=True) - else: - header = ("Tempest environment:\n" - " Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % - (os.getenv('INSTALLER_TYPE', 'Unknown'), - os.getenv('DEPLOY_SCENARIO', 'Unknown'), - os.getenv('NODE_NAME', 'Unknown'), - time.strftime("%a %b %d %H:%M:%S %Z %Y"))) - - f_stdout = open(TEMPEST_RESULTS_DIR + "/tempest.log", 'w+') - f_stderr = open(TEMPEST_RESULTS_DIR + "/tempest-error.log", 'w+') - f_env = open(TEMPEST_RESULTS_DIR + "/environment.log", 'w+') - f_env.write(header) - - subprocess.call(cmd_line, shell=True, stdout=f_stdout, stderr=f_stderr) - - f_stdout.close() - f_stderr.close() - f_env.close() - - cmd_line = "rally verify show" - ft_utils.execute_command(cmd_line, logger, - exit_on_error=True, info=True) + header = ("Tempest environment:\n" + " Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % + (os.getenv('INSTALLER_TYPE', 'Unknown'), + os.getenv('DEPLOY_SCENARIO', 'Unknown'), + os.getenv('NODE_NAME', 'Unknown'), + time.strftime("%a %b %d %H:%M:%S %Z %Y"))) + + f_stdout = open(TEMPEST_RESULTS_DIR + "/tempest.log", 'w+') + f_stderr = open(TEMPEST_RESULTS_DIR + "/tempest-error.log", 'w+') + f_env = open(TEMPEST_RESULTS_DIR + "/environment.log", 'w+') + f_env.write(header) + + subprocess.call(cmd_line, shell=True, stdout=f_stdout, stderr=f_stderr) + + f_stdout.close() + f_stderr.close() + f_env.close() + + cmd_line = "rally verify show" + ft_utils.execute_command(cmd_line, logger, + exit_on_error=True, info=True) cmd_line = "rally verify list" logger.debug('Executing command : {}'.format(cmd_line)) -- cgit 1.2.3-korg