aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/rally
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2019-06-02 14:43:10 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2019-06-02 14:48:29 +0200
commitbc88eff8f5850f8207431bb8d1958fe6b9cd09e8 (patch)
treec76139867a2c9fe5195ddec0a17cf2451effd4b6 /functest/opnfv_tests/openstack/rally
parentff54445d53b9e45773b8b56eb24732cdab73d76d (diff)
Publish rally logs
Both Rally and Tempest publish Rally debug logs. It also moves the logics from tempest to rally. Change-Id: I5c057d830202baddd73577ade1b09ce304e3c5a5 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/opnfv_tests/openstack/rally')
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index 6dfdabec8..61352c1ed 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -629,6 +629,7 @@ class RallyBase(singlevm.VmReady2):
def clean(self):
"""Cleanup of OpenStack resources. Should be called on completion."""
self.clean_rally_conf()
+ self.clean_rally_logs()
if self.flavor_alt:
self.orig_cloud.delete_flavor(self.flavor_alt.id)
super(RallyBase, self).clean()
@@ -641,12 +642,43 @@ class RallyBase(singlevm.VmReady2):
return super(RallyBase, self).is_successful()
+ @staticmethod
+ def update_rally_logs(res_dir, rally_conf='/etc/rally/rally.conf'):
+ """Print rally logs in res dir"""
+ if not os.path.exists(res_dir):
+ os.makedirs(res_dir)
+ rconfig = configparser.RawConfigParser()
+ rconfig.read(rally_conf)
+ rconfig.set('DEFAULT', 'debug', True)
+ rconfig.set('DEFAULT', 'use_stderr', False)
+ rconfig.set('DEFAULT', 'log-file', 'rally.log')
+ rconfig.set('DEFAULT', 'log_dir', res_dir)
+ with open(rally_conf, 'w') as config_file:
+ rconfig.write(config_file)
+
+ @staticmethod
+ def clean_rally_logs(rally_conf='/etc/rally/rally.conf'):
+ """Clean Rally config"""
+ rconfig = configparser.RawConfigParser()
+ rconfig.read(rally_conf)
+ if rconfig.has_option('DEFAULT', 'use_stderr'):
+ rconfig.remove_option('DEFAULT', 'use_stderr')
+ if rconfig.has_option('DEFAULT', 'debug'):
+ rconfig.remove_option('DEFAULT', 'debug')
+ if rconfig.has_option('DEFAULT', 'log-file'):
+ rconfig.remove_option('DEFAULT', 'log-file')
+ if rconfig.has_option('DEFAULT', 'log_dir'):
+ rconfig.remove_option('DEFAULT', 'log_dir')
+ with open(rally_conf, 'w') as config_file:
+ rconfig.write(config_file)
+
def run(self, **kwargs):
"""Run testcase."""
self.start_time = time.time()
try:
assert super(RallyBase, self).run(
**kwargs) == testcase.TestCase.EX_OK
+ self.update_rally_logs(self.res_dir)
self.create_rally_deployment(environ=self.project.get_environ())
self.prepare_run(**kwargs)
self.run_tests(**kwargs)