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
This commit is contained in:
Balazs Gibizer 2019-05-02 12:24:19 -06:00
parent 11de108daa
commit 93027713ab
2 changed files with 11 additions and 0 deletions

View File

@ -188,6 +188,12 @@ class StandardLogging(fixtures.Fixture):
self.useFixture(
fixtures.MonkeyPatch('oslo_log.log.setup', fake_logging_setup))
def delete_stored_logs(self):
# NOTE(gibi): this depends on the internals of the fixtures.FakeLogger.
# This could be enhanced once the PR
# https://github.com/testing-cabal/fixtures/pull/42 merges
self.logger._output.truncate(0)
class OutputStreamCapture(fixtures.Fixture):
"""Capture output streams during tests.

View File

@ -408,6 +408,11 @@ class TestInstanceNotificationSample(
# Ensure that instance is in active state after an action
self._wait_for_state_change(self.admin_api, server, 'ACTIVE')
# if the test step did not raised then we consider the step as
# succeeded. We drop the logs to avoid causing subunit parser
# errors due to logging too much at the end of the test case.
self.stdlog.delete_stored_logs()
def test_create_delete_server(self):
fake_trusted_certs = ['cert-id-1', 'cert-id-2']
server = self._boot_a_server(