Skip to content

Commit

Permalink
checkconfig: execute it in a reactor
Browse files Browse the repository at this point in the history
For configuration that create deferreds
during the load of the config (for example services), a
reactor is needed.
  • Loading branch information
Ion Alberdi committed Mar 17, 2015
1 parent 48c8bca commit d78107d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions master/buildbot/scripts/checkconfig.py
Expand Up @@ -18,6 +18,7 @@

from buildbot import config
from buildbot.scripts.base import getConfigFileFromTac
from buildbot.util import in_reactor


def _loadConfig(basedir, configFile, quiet):
Expand All @@ -36,6 +37,7 @@ def _loadConfig(basedir, configFile, quiet):
return 0


@in_reactor
def checkconfig(config):
quiet = config.get('quiet')
configFile = config.get('configFile', os.getcwd())
Expand Down
3 changes: 3 additions & 0 deletions master/buildbot/test/unit/test_scripts_checkconfig.py
Expand Up @@ -142,6 +142,9 @@ class TestCheckconfig(unittest.TestCase):

def setUp(self):
self.loadConfig = mock.Mock(spec=checkconfig._loadConfig, return_value=3)
# checkconfig is decorated with @in_reactor, so strip that decoration
# since the reactor is already running
self.patch(checkconfig, 'checkconfig', checkconfig.checkconfig._orig)
self.patch(checkconfig, '_loadConfig', self.loadConfig)

def test_checkconfig_default(self):
Expand Down

0 comments on commit d78107d

Please sign in to comment.