You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cthorn42
added
accepted
Valid issue that we intend to work on when we have the bandwidth
triaged
Jira issue has been created for this
and removed
accepted
Valid issue that we intend to work on when we have the bandwidth
labels
May 21, 2024
Describe the Bug
While rearching #2664 and #2715 I noticed a few different classes of issues with Facter's logging system.
Tests often overwrite the global
Logger
with an instance_spy, but don't restore the original logger after each test:This causes global state to leak across tests leading to rspec reporting:
Tests also overwrite the global logger with an instance spy and restore it with a different logger instance instead of the original instance:
A similar problem exists with resolvers as the each resolver class has a
Facter::Log
instance:The problem is made worse, because some resolvers eagerly create their resolver:
While others rely on the BaseResolver to lazily create it:
As a result, you can never be sure if a resolver has a logger, and if so, who created it (the code or test).
Finally if aggregated facts are evaluated twice, they attempt to log a message to a nil logger.
Expected Behavior
Since Facter's
Logger
andFacter::Log
are global state, they should be immutable.The text was updated successfully, but these errors were encountered: