Project

Profile

Help

Issue #1409

config loading methods are calling in the wrong order

Added by semyers almost 5 years ago. Updated over 1 year ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
3. High
Version:
Master
Platform Release:
2.8.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

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

Related to Pulp - Issue #607: server/config.py reads server.conf when the module is loaded.CLOSED - CURRENTRELEASE<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision bef25c08 View on GitHub
Added by semyers almost 5 years ago

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

Revision bef25c08 View on GitHub
Added by semyers almost 5 years ago

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

History

#1 Updated by semyers almost 5 years ago

  • Status changed from ASSIGNED to POST

#2 Updated by semyers almost 5 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#3 Updated by semyers almost 5 years ago

  • Related to Issue #607: server/config.py reads server.conf when the module is loaded. added

#4 Updated by dkliban@redhat.com over 4 years ago

  • Status changed from MODIFIED to 5

#5 Updated by dkliban@redhat.com over 4 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE

#6 Updated by bmbouter over 1 year ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF