Skip to content

Commit 9302771

Browse files
author
Balazs Gibizer
committed
Reset the stored logs at each notification test steps
This is an atempt to solve a new appearance of bug 1813147 where the long test_instance_action notification sample test case logs too much. This patch drops the logs of each successful test step to try to avoid the overload of the logging system. Change-Id: I0e5db9b2f423ab92ff93b6b3aada7d6b79a7abf6 Related-Bug: #1813147
1 parent 11de108 commit 9302771

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
@@ -188,6 +188,12 @@ def fake_logging_setup(*args):
188188
self.useFixture(
189189
fixtures.MonkeyPatch('oslo_log.log.setup', fake_logging_setup))
190190

191+
def delete_stored_logs(self):
192+
# NOTE(gibi): this depends on the internals of the fixtures.FakeLogger.
193+
# This could be enhanced once the PR
194+
# https://github.com/testing-cabal/fixtures/pull/42 merges
195+
self.logger._output.truncate(0)
196+
191197

192198
class OutputStreamCapture(fixtures.Fixture):
193199
"""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
@@ -408,6 +408,11 @@ def test_instance_action(self):
408408
# Ensure that instance is in active state after an action
409409
self._wait_for_state_change(self.admin_api, server, 'ACTIVE')
410410

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

0 commit comments

Comments
 (0)