Unit test logging
Tempest used to have logging.conf sample which included stress logging, it was removed from tempest adding more up date version here. Also test cases can fail with an assert method which considered failure not error. Having the test case exceptions logged. Stop overriding the working logger name, as no other action does such override. Change-Id: I46898b705b58ae5921a4c2e6b95ab4c841dbc9af
This commit is contained in:
parent
f3b105971b
commit
7103432b92
|
@ -10,7 +10,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
from tempest_stress import config
|
||||
|
||||
|
@ -50,7 +49,6 @@ class UnitTest(stressaction.StressAction):
|
|||
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)
|
||||
|
@ -69,7 +67,10 @@ class UnitTest(stressaction.StressAction):
|
|||
def run_core(self):
|
||||
res = self.klass(self.test_method).run()
|
||||
if res.errors:
|
||||
raise RuntimeError(res.errors)
|
||||
raise RuntimeError(res.errors[0][1])
|
||||
|
||||
if res.failures:
|
||||
raise RuntimeError(res.failures[0][1])
|
||||
|
||||
def run(self):
|
||||
if self.class_setup_per != SetUpClassRunTime.application:
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
[loggers]
|
||||
keys=root,tempest_stress
|
||||
|
||||
[handlers]
|
||||
keys=file,devel,syslog
|
||||
|
||||
# set the level to DEBUG for more verbosity
|
||||
[logger_tempest_stress]
|
||||
level=INFO
|
||||
handlers=file,devel
|
||||
qualname=tempest_stress
|
||||
|
||||
[formatters]
|
||||
keys=simple,tests
|
||||
|
||||
[logger_root]
|
||||
level=DEBUG
|
||||
handlers=file
|
||||
|
||||
[handler_file]
|
||||
class=FileHandler
|
||||
level=DEBUG
|
||||
args=('tempest.log', 'w+')
|
||||
formatter=tests
|
||||
|
||||
[handler_syslog]
|
||||
class=handlers.SysLogHandler
|
||||
level=ERROR
|
||||
args = ('/dev/log', handlers.SysLogHandler.LOG_USER)
|
||||
|
||||
[handler_devel]
|
||||
class=StreamHandler
|
||||
level=DEBUG
|
||||
args=(sys.stdout,)
|
||||
formatter=simple
|
||||
|
||||
[formatter_tests]
|
||||
class = oslo_log.formatters.ContextFormatter
|
||||
|
||||
[formatter_simple]
|
||||
format=%(asctime)s.%(msecs)03d %(process)d %(levelname)s: %(message)s
|
Loading…
Reference in New Issue