Skip to content

Commit

Permalink
integration test for trac #2951
Browse files Browse the repository at this point in the history
add a test for the case which the db is too slow to complete the newLog before end of the step

if I revert previous commit, I get the error reported by benallard

===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/Users/ptardy/dev/bb/buildbot-heroku/buildbot/master/buildbot/process/buildstep.py", line 157, in next
    self._catchup()
  File "/Users/ptardy/dev/bb/buildbot-heroku/buildbot/master/buildbot/process/buildstep.py", line 159, in _catchup
    self.step._start_unhandled_deferreds.append(d)
exceptions.AttributeError: 'NoneType' object has no attribute 'append'

buildbot.test.integration.test_custom_buildstep.RunSteps.test_OldStyleCustomBuildStepSlowDB
buildbot.test.integration.test_custom_buildstep.RunSteps.test_OldStyleCustomBuildStepSlowDB
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/Users/ptardy/dev/bb/buildbot-heroku/buildbot/master/buildbot/process/buildstep.py", line 135, in gotAsync
    self._catchup()
  File "/Users/ptardy/dev/bb/buildbot-heroku/buildbot/master/buildbot/process/buildstep.py", line 159, in _catchup
    self.step._start_unhandled_deferreds.append(d)
exceptions.AttributeError: 'NoneType' object has no attribute 'append'

buildbot.test.integration.test_custom_buildstep.RunSteps.test_OldStyleCustomBuildStepSlowDB

Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
  • Loading branch information
Pierre Tardy committed Oct 27, 2014
1 parent 61a7ac8 commit 4721f54
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion master/buildbot/test/integration/test_custom_buildstep.py
Expand Up @@ -227,7 +227,21 @@ def assertLogs(self, exp_logs):
self.assertEqual(got_logs, exp_logs)

@defer.inlineCallbacks
def test_OldStyleCustomBuildStep(self):
def doOldStyleCustomBuildStep(self, slowDB=False):
if slowDB:
oldNewLog = self.master.data.updates.newLog

def newLog(*args, **kw):
d = defer.Deferred()

def delayed():
r = oldNewLog(*args, **kw)
r.addCallback(d.callback)

reactor.callLater(.1, delayed)
return d
self.patch(self.master.data.updates, "newLog", newLog)

self.factory.addStep(OldStyleCustomBuildStep(arg1=1, arg2=2))
yield self.do_test_step()

Expand All @@ -239,10 +253,18 @@ def test_OldStyleCustomBuildStep(self):
# 'stdout\n\xe2\x98\x83\nstderr\n',
u'ostdout\no\N{SNOWMAN}\nestderr\n',
u'obs':
# if slowDB, the observer wont see anything before the end of this instant step
u'Observer saw []\n' if slowDB else
# 'Observer saw [\'stdout\\n\', \'\\xe2\\x98\\x83\\n\']',
u'Observer saw [u\'stdout\\n\', u\'\\u2603\\n\']\n',
})

def test_OldStyleCustomBuildStep(self):
return self.doOldStyleCustomBuildStep(False)

def test_OldStyleCustomBuildStepSlowDB(self):
return self.doOldStyleCustomBuildStep(True)

@defer.inlineCallbacks
def test_OldStyleCustomBuildStep_failure(self):
self.factory.addStep(OldStyleCustomBuildStep(arg1=1, arg2=2, doFail=1))
Expand Down

0 comments on commit 4721f54

Please sign in to comment.