Add logging_error_fixture to functional tests
The fixture will cause a formatting error when writing logs to be raised as an exception (thus failing tests). In the non-gabbi tests the fixture is started in the normal way with useFixture. In the gabbi tests the fixture setUp and cleanUp is done manually because the fixtures start and stop per yaml file, not per test. Change-Id: Ia5094c3a12bcb9d19d429fbe2164b4533ca9c715
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture as config_fixture
|
||||
from oslo_log.fixture import logging_error
|
||||
from oslotest import output
|
||||
import testtools
|
||||
|
||||
@@ -53,6 +54,7 @@ class TestCase(testtools.TestCase):
|
||||
self.useFixture(output.CaptureOutput())
|
||||
# Filter ignorable warnings during test runs.
|
||||
self.useFixture(capture.WarningsFixture())
|
||||
self.useFixture(logging_error.get_logging_handle_error_fixture())
|
||||
|
||||
self.placement_db = self.useFixture(
|
||||
fixtures.Database(database='placement'))
|
||||
|
||||
@@ -16,6 +16,7 @@ import os
|
||||
from gabbi import fixture
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture as config_fixture
|
||||
from oslo_log.fixture import logging_error
|
||||
from oslo_middleware import cors
|
||||
from oslo_policy import opts as policy_opts
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
@@ -54,6 +55,9 @@ class APIFixture(fixture.GabbiFixture):
|
||||
self.standard_logging_fixture.setUp()
|
||||
self.output_stream_fixture = output.CaptureOutput()
|
||||
self.output_stream_fixture.setUp()
|
||||
self.logging_error_fixture = (
|
||||
logging_error.get_logging_handle_error_fixture())
|
||||
self.logging_error_fixture.setUp()
|
||||
# Filter ignorable warnings during test runs.
|
||||
self.warnings_fixture = capture.WarningsFixture()
|
||||
self.warnings_fixture.setUp()
|
||||
@@ -117,6 +121,7 @@ class APIFixture(fixture.GabbiFixture):
|
||||
self.warnings_fixture.cleanUp()
|
||||
self.output_stream_fixture.cleanUp()
|
||||
self.standard_logging_fixture.cleanUp()
|
||||
self.logging_error_fixture.cleanUp()
|
||||
self.conf_fixture.cleanUp()
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user