diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2016-01-29 17:03:41 +0100 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2016-01-29 16:33:12 +0000 |
commit | 815c7318020a6a39330bb5e5fc09edb023de7f47 (patch) | |
tree | 853372e69eb7a91c0d4c797febebb3b0d8a1303d /testcases/VIM/OpenStack/CI/libraries/run_tempest.py | |
parent | 70fb6474d27416b1ad40d58c78c7dde83f19d19a (diff) |
Create stdout and stderr files for Tempest results
Change-Id: Ibd45dd628dc64db16af28102276f5523f55fcaf4
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
(cherry picked from commit c04286e7e407ebfc383f1e69ae1b7c3e015b9971)
Diffstat (limited to 'testcases/VIM/OpenStack/CI/libraries/run_tempest.py')
-rw-r--r-- | testcases/VIM/OpenStack/CI/libraries/run_tempest.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py index 0097a567b..50dd2521c 100644 --- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py +++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py @@ -21,6 +21,7 @@ import re import requests import subprocess import sys +import time import yaml import keystoneclient.v2_0.client as ksclient from neutronclient.v2_0 import client as neutronclient @@ -220,13 +221,23 @@ def run_tempest(OPTION): else: if not os.path.exists(TEMPEST_RESULTS_DIR): os.makedirs(TEMPEST_RESULTS_DIR) - - f = open(TEMPEST_RESULTS_DIR+"/tempest.log", 'w+') - FNULL = open(os.devnull, 'w') - - subprocess.call(cmd_line, shell=True, stdout=FNULL, stderr=f) - f.close() - FNULL.close() + 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" subprocess.call(cmd_line, shell=True) |