Cleanup test logging
We were overlogging because we check for an openssl flag early and warn if it isn't present. That warning creates a default root streamhandler that emits to stderr causing all our logging to be emitted there. Fix this by creating a specific logger for this warning (avoids polluting the root logger) and add an assertion that the root logger's handler list is empty when we modify it for testing. Note I'm not sure why this warning is happening now and wasn't before. Maybe our openssl installations changed or cryptography modified the flag? This is worth investigating in a followup. Change-Id: I2a82cd6575e86facb80b28c81418ddfee8a32fa5
This commit is contained in:
@@ -28,8 +28,12 @@ if hasattr(backend, '_rsa_skip_check_key'):
|
||||
backend._rsa_skip_check_key = True
|
||||
else:
|
||||
import logging
|
||||
logging.warning("Cryptography backend lacks _rsa_skip_check_key flag, "
|
||||
"key loading may be slow")
|
||||
# Use a specific logger here to avoid polluting the root logger
|
||||
# with the default stderr stream handler. This is important in
|
||||
# testing to ensure we don't over log and create noise.
|
||||
logger = logging.getLogger("zuul.rsa_skip_check_warning")
|
||||
logger.warning("Cryptography backend lacks _rsa_skip_check_key flag, "
|
||||
"key loading may be slow")
|
||||
|
||||
|
||||
# https://cryptography.io/en/latest/hazmat/primitives/asymmetric/rsa/#generation
|
||||
|
||||
Reference in New Issue
Block a user