[Buildbot-commits] buildbot/buildbot/test runutils.py, 1.20, 1.21 test_run.py, 1.43, 1.44 test_slaves.py, 1.8, 1.9

Brian Warner warner at users.sourceforge.net
Tue Jul 3 17:25:10 UTC 2007


Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11483/buildbot/test

Modified Files:
	runutils.py test_run.py test_slaves.py 
Log Message:
[project @ RunMixin.disappearSlave: allow callers to control the allowReconnect behavior]

Original author: warner at lothar.com
Date: 2007-07-03 17:24:36+00:00

Index: runutils.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/runutils.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- runutils.py	3 Jul 2007 02:22:19 -0000	1.20
+++ runutils.py	3 Jul 2007 17:25:08 -0000	1.21
@@ -193,7 +193,8 @@
         broker.transport.loseConnection()
         del self.slaves['bot1']
 
-    def disappearSlave(self, slavename="bot1", buildername="dummy"):
+    def disappearSlave(self, slavename="bot1", buildername="dummy",
+                       allowReconnect=False):
         # the slave's host has vanished off the net, leaving the connection
         # dangling. This will be detected quickly by app-level keepalives or
         # a ping, or slowly by TCP timeouts.
@@ -206,9 +207,10 @@
         broker = bot.builders[buildername].remote.broker
         broker.dataReceived = discard # seal its ears
         broker.transport.write = discard # and take away its voice
-        # also discourage it from reconnecting once the connection goes away
-        assert self.slaves[slavename].bf.continueTrying
-        self.slaves[slavename].bf.continueTrying = False
+        if not allowReconnect:
+            # also discourage it from reconnecting once the connection goes away
+            assert self.slaves[slavename].bf.continueTrying
+            self.slaves[slavename].bf.continueTrying = False
 
     def ghostSlave(self):
         # the slave thinks it has lost the connection, and initiated a

Index: test_run.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_run.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- test_run.py	11 Dec 2006 08:23:29 -0000	1.43
+++ test_run.py	3 Jul 2007 17:25:08 -0000	1.44
@@ -186,8 +186,7 @@
 
     def testIdle2(self):
         # now suppose the slave goes missing
-        self.slaves['bot1'].bf.continueTrying = 0
-        self.disappearSlave()
+        self.disappearSlave(allowReconnect=False)
 
         # forcing a build will work: the build detect that the slave is no
         # longer available and will be re-queued. Wait 5 seconds, then check
@@ -356,8 +355,7 @@
         self.failUnlessEqual(res, True)
 
         # now, before any build is run, make the slave disappear
-        self.slaves['bot1'].bf.continueTrying = 0
-        self.disappearSlave()
+        self.disappearSlave(allowReconnect=False)
 
         # at this point, a ping to the slave should timeout
         d = bc.ping(1)
@@ -375,8 +373,7 @@
         self.failUnlessEqual(ss.getAdmin(), "one")
 
         # now, before any build is run, make the first slave disappear
-        self.slaves['bot1'].bf.continueTrying = 0
-        self.disappearSlave()
+        self.disappearSlave(allowReconnect=False)
 
         d = self.master.botmaster.waitUntilBuilderDetached("dummy")
         # now let the new slave take over
@@ -447,7 +444,7 @@
 
         d = self.master.botmaster.waitUntilBuilderDetached("dummy")
         # whoops! how careless of me.
-        self.disappearSlave()
+        self.disappearSlave(allowReconnect=True)
         # the slave will realize the connection is lost within 2 seconds, and
         # reconnect.
         d.addCallback(self._testSlaveTimeout_2)

Index: test_slaves.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_slaves.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- test_slaves.py	3 Jul 2007 02:22:19 -0000	1.8
+++ test_slaves.py	3 Jul 2007 17:25:08 -0000	1.9
@@ -133,7 +133,7 @@
         b1.START_BUILD_TIMEOUT = 1
         assert b1.CHOOSE_SLAVES_RANDOMLY
         b1.CHOOSE_SLAVES_RANDOMLY = False
-        self.disappearSlave("bot1", "b1")
+        self.disappearSlave("bot1", "b1", allowReconnect=False)
         d = self.doBuild("b1")
         d.addCallback(self._testFallback2_1)
         return d





More information about the Commits mailing list