Skip to content

Commit

Permalink
failing test case replicating bug discovered by Mark A. Grondona <mgr…
Browse files Browse the repository at this point in the history
…ondona@llnl.gov>, with fix
  • Loading branch information
Dustin J. Mitchell committed Jan 1, 2009
1 parent 37c24a9 commit c223f87
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
5 changes: 5 additions & 0 deletions buildbot/scheduler.py
Expand Up @@ -275,6 +275,11 @@ def getPendingBuildTimes(self):
bts.append(s.nextBuildTime)
return bts

def buildSetFinished(self, bss):
# we don't care if a build has finished; one of the per-branch builders
# will take care of it, instead.
pass

def addChange(self, change):
branch = change.branch
if self.branches is not None and branch not in self.branches:
Expand Down
50 changes: 50 additions & 0 deletions buildbot/test/test_run.py
Expand Up @@ -921,3 +921,53 @@ def _testBuilderNoStepEnv1(self, res):
s = build.currentStep
self.failUnless('blah' in s.cmd.args['env'])
self.failUnlessEqual('bar', s.cmd.args['env']['blah'])

class SchedulerWatchers(RunMixin, TestFlagMixin, unittest.TestCase):
config_watchable = config_base + """
from buildbot.scheduler import AnyBranchScheduler
from buildbot.steps.dummy import Dummy
from buildbot.test.runutils import setTestFlag, SetTestFlagStep
s = AnyBranchScheduler(
name='abs',
branches=None,
treeStableTimer=0,
builderNames=['a', 'b'])
c['schedulers'] = [ s ]
# count the number of times a success watcher is called
numCalls = [ 0 ]
def watcher(ss):
numCalls[0] += 1
setTestFlag("numCalls", numCalls[0])
s.subscribeToSuccessfulBuilds(watcher)
f = factory.BuildFactory()
f.addStep(Dummy(timeout=0))
c['builders'] = [{'name': 'a', 'slavename': 'bot1',
'builddir': 'a', 'factory': f},
{'name': 'b', 'slavename': 'bot1',
'builddir': 'b', 'factory': f}]
"""

def testWatchers(self):
self.clearFlags()
m = self.master
m.loadConfig(self.config_watchable)
m.readConfig = True
m.startService()

c = changes.Change("bob", ["Makefile", "foo/bar.c"], "changed stuff")
m.change_svc.addChange(c)

d = self.connectSlave(builders=['a', 'b'])

def pause(res):
d = defer.Deferred()
reactor.callLater(1, d.callback, res)
return d
d.addCallback(pause)

def checkFn(res):
self.failUnlessEqual(self.getFlag('numCalls'), 1)
d.addCallback(checkFn)
return d

0 comments on commit c223f87

Please sign in to comment.