Skip to content

Commit

Permalink
Merge pull request #1678 from yetanotherion/master
Browse files Browse the repository at this point in the history
test_stop_trigger: fix remote_interruptCommand no attribute error
  • Loading branch information
Mikhail Sobolev committed May 22, 2015
2 parents 1c1567d + 7c9a059 commit 992e766
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion master/buildbot/buildslave/protocols/base.py
Expand Up @@ -74,7 +74,7 @@ def remoteShutdown(self):
def remoteStartBuild(self, builderName):
raise NotImplementedError

def remoteInterruptCommand(self, commandId, why):
def remoteInterruptCommand(self, builderName, commandId, why):
raise NotImplementedError


Expand Down
5 changes: 3 additions & 2 deletions master/buildbot/buildslave/protocols/null.py
Expand Up @@ -87,5 +87,6 @@ def remoteShutdown(self):
def remoteStartBuild(self, builderName):
return defer.succeed(self.buildslave.bot.builders[builderName].remote_startBuild())

def remoteInterruptCommand(self, commandId, why):
return defer.maybeDeferred(self.buildslave.bot.remote_interruptCommand, commandId, why)
def remoteInterruptCommand(self, builderName, commandId, why):
slavebuilder = self.buildslave.bot.builders[builderName]
return defer.maybeDeferred(slavebuilder.remote_interruptCommand, commandId, why)
5 changes: 3 additions & 2 deletions master/buildbot/buildslave/protocols/pb.py
Expand Up @@ -268,8 +268,9 @@ def remoteStartBuild(self, builderName):
slavebuilder = self.builders.get(builderName)
return slavebuilder.callRemote('startBuild')

def remoteInterruptCommand(self, commandId, why):
return defer.maybeDeferred(self.mind.callRemote, "interruptCommand",
def remoteInterruptCommand(self, builderName, commandId, why):
slavebuilder = self.builders.get(builderName)
return defer.maybeDeferred(slavebuilder.callRemote, "interruptCommand",
commandId, why)

# perspective methods called by the slave
Expand Down
3 changes: 2 additions & 1 deletion master/buildbot/process/remotecommand.py
Expand Up @@ -158,7 +158,8 @@ def interrupt(self, why):
# tell the remote command to halt. Returns a Deferred that will fire
# when the interrupt command has been delivered.

d = self.conn.remoteInterruptCommand(self.commandID, str(why))
d = self.conn.remoteInterruptCommand(self.builder_name,
self.commandID, str(why))
# the slave may not have remote_interruptCommand
d.addErrback(self._interruptFailed)
return d
Expand Down
4 changes: 2 additions & 2 deletions master/buildbot/test/fake/fakeprotocol.py
Expand Up @@ -59,6 +59,6 @@ def remoteStartBuild(self, builderName):
self.remoteCalls.append(('remoteStartBuild', builderName))
return defer.succeed(None)

def remoteInterruptCommand(self, commandId, why):
self.remoteCalls.append(('remoteInterruptCommand', commandId, why))
def remoteInterruptCommand(self, builderName, commandId, why):
self.remoteCalls.append(('remoteInterruptCommand', builderName, commandId, why))
return defer.succeed(None)
20 changes: 20 additions & 0 deletions master/buildbot/test/integration/test_stop_trigger.py
Expand Up @@ -14,6 +14,7 @@
# Copyright Buildbot Team Members

from twisted.internet import defer
from twisted.internet import reactor

from buildbot.config import BuilderConfig
from buildbot.plugins import schedulers
Expand Down Expand Up @@ -84,6 +85,8 @@ def nextBuild(*args, **kwargs):

class TriggeringMaster(RunMasterBase):
testCasesHandleTheirSetup = True
proto = "pb"

change = dict(branch="master",
files=["foo.c"],
author="me@foo.com",
Expand Down Expand Up @@ -122,6 +125,23 @@ def newCallback(_, data):
self.higherBuild = None
yield self.runTest(newCallback)

@defer.inlineCallbacks
def testTriggerRunsForeverAfterCmdStarted(self):
yield self.setupConfig("triggerRunsForever")
self.higherBuild = None

def newCallback(_, data):
if self.higherBuild is None:
self.higherBuild = data['buildid']
else:

def f():
self.master.data.control("stop", {}, ("builds", self.higherBuild))
self.higherBuild = None
reactor.callLater(5.0, f)

yield self.runTest(newCallback)

@defer.inlineCallbacks
def testTriggeredBuildIsNotCreated(self):
yield self.setupConfig("triggeredBuildIsNotCreated")
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/test/util/protocols.py
Expand Up @@ -65,5 +65,5 @@ def remoteStartBuild(self, builderName):

def test_sig_remoteInterruptCommand(self):
@self.assertArgSpecMatches(self.conn.remoteInterruptCommand)
def remoteInterruptCommand(commandId, why):
def remoteInterruptCommand(builderName, commandId, why):
pass

0 comments on commit 992e766

Please sign in to comment.