Issue #1409
closedconfig loading methods are calling in the wrong order
Description
bmbouter brought this to my attention:
ERROR: test suite for <module 'test.unit' from '/home/vagrant/devel/pulp_rpm/plugins/test/unit/__init__.py'>
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vagrant/.virtualenvs/pulp_rpm/lib/python2.7/site-packages/nose/suite.py", line 209, in run
self.setUp()
File "/home/vagrant/.virtualenvs/pulp_rpm/lib/python2.7/site-packages/nose/suite.py", line 292, in setUp
self.setupContext(ancestor)
File "/home/vagrant/.virtualenvs/pulp_rpm/lib/python2.7/site-packages/nose/suite.py", line 315, in setupContext
try_run(context, names)
File "/home/vagrant/.virtualenvs/pulp_rpm/lib/python2.7/site-packages/nose/util.py", line 471, in try_run
return func()
File "/home/vagrant/devel/pulp_rpm/plugins/test/unit/__init__.py", line 13, in setup
devel_base.start_database_connection()
File "/home/vagrant/devel/pulp/devel/pulp/devel/unit/server/base.py", line 24, in start_database_connection
_load_test_config()
File "/home/vagrant/devel/pulp/devel/pulp/devel/unit/server/base.py", line 54, in _load_test_config
start_logging()
File "/home/vagrant/devel/pulp/server/pulp/server/logs.py", line 46, in start_logging
log_level = config.config.get('server', 'log_level')
File "/usr/lib64/python2.7/ConfigParser.py", line 604, in get
sectiondict = self._sections[section]
File "/home/vagrant/devel/pulp/server/pulp/server/config.py", line 23, in _sections
self._load_config()
File "/home/vagrant/devel/pulp/server/pulp/server/config.py", line 38, in _load_config
self.set(section, option, value)
File "/home/vagrant/devel/pulp/devel/pulp/devel/unit/server/base.py", line 40, in _enforce_config
raise Exception("Do not change the config during test runs! Please use "
Exception: Do not change the config during test runs! Please use pulp.devel.mock_config.patch instead.
This is related to some changes that I put into place in #607. config alterations are being blocked in _load_test_config(), but they should not be.
The fix probably involves changing the order of funciton calls in _load_test_config to be more explicit about the server config state during loading, while still ensuring that attempts to alter the config during a test run are properly blocked.
Whether those attempts should be blocked is another issue entirely. :)
This is blocking at least one team member from completing his work on the 2.8 release, so I'm filing this as High Priority/Severity and self-assigning it.
Related issues
Updated by semyers about 9 years ago
- Status changed from ASSIGNED to POST
Added by semyers about 9 years ago
Added by semyers about 9 years ago
Revision bef25c08 | View on GitHub
Reorder config attr overrides to prevent explosions
start_logging() is called in _load_test_config, which triggers conf load, but fails, because loading the config sets defaults, which is blocked by overridden config attrs.
https://i.imgur.com/KJyc4gz.gifv
restoring the config setters for the duration of _load_test_config safely prevents that explosion. I also added more/better tests to confirm expectations of the config override/restore mechanism
fixes #1409
Updated by semyers about 9 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulp|bef25c08bd65f4bf1bd149ed037ccf816f33c04e.
Updated by semyers about 9 years ago
- Related to Issue #607: server/config.py reads server.conf when the module is loaded. added
Updated by dkliban@redhat.com almost 9 years ago
- Status changed from MODIFIED to 5
Updated by dkliban@redhat.com almost 9 years ago
- Status changed from 5 to CLOSED - CURRENTRELEASE
Reorder config attr overrides to prevent explosions
start_logging() is called in _load_test_config, which triggers conf load, but fails, because loading the config sets defaults, which is blocked by overridden config attrs.
https://i.imgur.com/KJyc4gz.gifv
restoring the config setters for the duration of _load_test_config safely prevents that explosion. I also added more/better tests to confirm expectations of the config override/restore mechanism
fixes #1409
https://pulp.plan.io/issues/1409