Change default test log level

Despite comments stating otherwise, we set our root logging level
to DEBUG. This causes some unwanted things to be logged to the
console and large test artifacts.

There is also some suspicion that this is causing test failures
with some kind of timing change with stestr causing subunit
parsing failures.

This changes the default level to be higher and fixes a few test
cases that had expected the previous default.

Change-Id: Ib7e45915898347549c12bc8276df556b272bb259
Closes-bug: #1728640
This commit is contained in:
Sean McGinnis 2017-11-07 23:41:28 -06:00
parent fb27334719
commit ab78a407f2
3 changed files with 8 additions and 8 deletions

View File

@ -73,7 +73,7 @@ class StandardLogging(fixtures.Fixture):
# set root logger to debug
root = std_logging.getLogger()
root.setLevel(std_logging.DEBUG)
root.setLevel(std_logging.INFO)
# supports collecting debug level for local runs
if os.environ.get('OS_DEBUG') in _TRUE_VALUES:

View File

@ -35,7 +35,8 @@ class TestLogging(testtools.TestCase):
# broken debug messages should still explode, even though we
# aren't logging them in the regular handler
self.assertRaises(TypeError, log.debug, "this is broken %s %s", "foo")
self.assertRaises(TypeError, log.warning,
"this is broken %s %s", "foo")
# and, ensure that one of the terrible log messages isn't
# output at info
@ -56,4 +57,4 @@ class TestLogging(testtools.TestCase):
log.info("at info")
log.debug("at debug")
self.assertIn("at info", stdlog.logger.output)
self.assertIn("at debug", stdlog.logger.output)
self.assertNotIn("at debug", stdlog.logger.output)

View File

@ -1491,7 +1491,7 @@ class TestLogLevels(test.TestCase):
def test_get_log_levels(self):
levels = utils.get_log_levels('cinder.api')
self.assertTrue(len(levels) > 1)
self.assertSetEqual({'DEBUG'}, set(levels.values()))
self.assertSetEqual({'INFO'}, set(levels.values()))
@ddt.data(None, '', 'wronglevel')
def test_set_log_levels_invalid(self, level):
@ -1501,16 +1501,15 @@ class TestLogLevels(test.TestCase):
def test_set_log_levels(self):
prefix = 'cinder.utils'
levels = utils.get_log_levels(prefix)
utils.set_log_levels(prefix, 'debug')
levels = utils.get_log_levels(prefix)
self.assertEqual('DEBUG', levels[prefix])
utils.set_log_levels(prefix, 'warning')
levels = utils.get_log_levels(prefix)
self.assertEqual('WARNING', levels[prefix])
utils.set_log_levels(prefix, 'debug')
levels = utils.get_log_levels(prefix)
self.assertEqual('DEBUG', levels[prefix])
@ddt.ddt
class TestCheckMetadataProperties(test.TestCase):