Fix logging problem for stress test wrappers
If using a stress test wrapper like UnitTest the logging output
only points to UnitTest itself and not to the executed action. This
makes log messages not readable.
Change-Id: I33afbf89f5a2cd922a569da62e7dbd7eeee61e8b
Fixes: bug #1216274
diff --git a/tempest/stress/actions/unit_test.py b/tempest/stress/actions/unit_test.py
index 95cc1bc..5ab5573 100644
--- a/tempest/stress/actions/unit_test.py
+++ b/tempest/stress/actions/unit_test.py
@@ -13,6 +13,7 @@
# under the License.
from tempest.openstack.common import importutils
+from tempest.openstack.common import log as logging
import tempest.stress.stressaction as stressaction
@@ -46,6 +47,7 @@
method = kwargs['test_method'].split('.')
self.test_method = method.pop()
self.klass = importutils.import_class('.'.join(method))
+ self.logger = logging.getLogger('.'.join(method))
# valid options are 'process', 'application' , 'action'
self.class_setup_per = kwargs.get('class_setup_per',
SetUpClassRunTime.process)
@@ -55,6 +57,12 @@
self.klass.setUpClass()
self.setupclass_called = False
+ @property
+ def action(self):
+ if self.test_method:
+ return self.test_method
+ return super(UnitTest, self).action
+
def run_core(self):
res = self.klass(self.test_method).run()
if res.errors: