Skip to content

Commit acd2daa

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Reset the stored logs at each notification test steps" into stable/stein
2 parents db40cc4 + 0956539 commit acd2daa

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

nova/tests/fixtures.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ def fake_logging_setup(*args):
182182
self.useFixture(
183183
fixtures.MonkeyPatch('oslo_log.log.setup', fake_logging_setup))
184184

185+
def delete_stored_logs(self):
186+
# NOTE(gibi): this depends on the internals of the fixtures.FakeLogger.
187+
# This could be enhanced once the PR
188+
# https://github.com/testing-cabal/fixtures/pull/42 merges
189+
self.logger._output.truncate(0)
190+
185191

186192
class OutputStreamCapture(fixtures.Fixture):
187193
"""Capture output streams during tests.

nova/tests/functional/notification_sample_tests/test_instance.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,11 @@ def test_instance_action(self):
407407
# Ensure that instance is in active state after an action
408408
self._wait_for_state_change(self.admin_api, server, 'ACTIVE')
409409

410+
# if the test step did not raised then we consider the step as
411+
# succeeded. We drop the logs to avoid causing subunit parser
412+
# errors due to logging too much at the end of the test case.
413+
self.stdlog.delete_stored_logs()
414+
410415
def test_create_delete_server(self):
411416
fake_trusted_certs = ['cert-id-1', 'cert-id-2']
412417
server = self._boot_a_server(

0 commit comments

Comments
 (0)