[Buildbot-commits] buildbot/buildbot/test test_scheduler.py,1.2,1.3 test_vc.py,1.38,1.39

Brian Warner warner at users.sourceforge.net
Thu Aug 11 08:22:19 UTC 2005


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

Modified Files:
	test_scheduler.py test_vc.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-277
Creator:  Brian Warner <warner at monolith.lothar.com>

make 'try' actually work, mostly

	* docs/buildbot.texinfo (try): add --port argument to PB style

	* buildbot/scripts/tryclient.py (SourceStampExtractor): return an
	actual SourceStamp. Still need to extract a branch name, somehow.
	(Try): finish implementing the try client side, still need a UI
	for specifying which builders to use
	(Try.getopt): factor our options/config-file reading
	* buildbot/test/test_scheduler.py (Scheduling.testTryUserpass):
	test it
	* buildbot/test/test_vc.py: match SourceStampExtractor change

	* buildbot/scripts/runner.py (Options.opt_verbose): --verbose
	causes the twisted log to be sent to stderr

	* buildbot/scheduler.py (Try_Userpass): implement the PB style

--This line, and those below, will be ignored--
Files to commit:
   <can't compute list>

This list might be incomplete or outdated if editing the log
message was not invoked from an up-to-date changes buffer!


Index: test_scheduler.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_scheduler.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- test_scheduler.py	10 Aug 2005 07:06:12 -0000	1.2
+++ test_scheduler.py	11 Aug 2005 08:22:17 -0000	1.3
@@ -5,8 +5,9 @@
 from twisted.trial import unittest
 from twisted.internet import defer, reactor
 from twisted.application import service
+from twisted.spread import pb
 
-from buildbot import scheduler
+from buildbot import scheduler, sourcestamp
 from buildbot.twcompat import maybeWait
 from buildbot.changes.changes import Change
 from buildbot.scripts import tryclient
@@ -19,6 +20,7 @@
         if self.d:
             reactor.callLater(0, self.d.callback, bs)
             self.d = None
+        return pb.Referenceable() # makes the cleanup work correctly
 
 class Scheduling(unittest.TestCase):
     def setUp(self):
@@ -172,9 +174,9 @@
         s = scheduler.Try_Jobdir("try1", ["a", "b"], jobdir)
         self.addScheduler(s)
         self.failIf(self.master.sets)
-        job1 = tryclient.createJob("buildsetID",
-                                   "branch1", "123", 1, "patch",
-                                   ["a", "b"])
+        job1 = tryclient.createJobfile("buildsetID",
+                                       "branch1", "123", 1, "diff",
+                                       ["a", "b"])
         self.master.d = d = defer.Deferred()
         self.pushJob(jobdir_abs, job1)
         d.addCallback(self._testTryJobdir_1)
@@ -184,11 +186,46 @@
         self.failUnlessEqual(bs.builderNames, ["a", "b"])
         self.failUnlessEqual(bs.source.branch, "branch1")
         self.failUnlessEqual(bs.source.revision, "123")
-        self.failUnlessEqual(bs.source.patch, (1, "patch"))
+        self.failUnlessEqual(bs.source.patch, (1, "diff"))
 
 
     def testTryUserpass(self):
-        raise unittest.SkipTest("not yet implemented")
         up = [("alice","pw1"), ("bob","pw2")]
-        s = scheduler.Try_Userpass("try2", None, userpass=up)
+        s = scheduler.Try_Userpass("try2", ["a", "b"], 0, userpass=up)
         self.addScheduler(s)
+        port = s.getPort()
+        config = {'connect': 'pb',
+                  'username': 'alice',
+                  'passwd': 'pw1',
+                  'master': "localhost:%d" % port,
+                  }
+        t = tryclient.Try(config)
+        ss = sourcestamp.SourceStamp("branch1", "123", (1, "diff"))
+        t.sourcestamp = ss
+        d2 = self.master.d = defer.Deferred()
+        d = t.deliverJob()
+        d.addCallback(self._testTryUserpass_1, t, d2)
+        return maybeWait(d, 5)
+    testTryUserpass.timeout = 5
+    def _testTryUserpass_1(self, res, t, d2):
+        # at this point, the Try object should have a RemoteReference to the
+        # status object. The FakeMaster returns a stub.
+        self.failUnless(t.buildsetStatus)
+        d2.addCallback(self._testTryUserpass_2, t)
+        return d2
+    def _testTryUserpass_2(self, bs, t):
+        # this should be the BuildSet submitted by the TryScheduler
+        self.failUnlessEqual(bs.builderNames, ["a", "b"])
+        self.failUnlessEqual(bs.source.branch, "branch1")
+        self.failUnlessEqual(bs.source.revision, "123")
+        self.failUnlessEqual(bs.source.patch, (1, "diff"))
+
+        t.cleanup()
+
+        # twisted-2.0.1 (but not later versions) seems to require a reactor
+        # iteration before stopListening actually works. TODO: investigate
+        # this.
+        d = defer.Deferred()
+        reactor.callLater(0, d.callback, None)
+        return d
+    

Index: test_vc.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_vc.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- test_vc.py	10 Aug 2005 08:15:44 -0000	1.38
+++ test_vc.py	11 Aug 2005 08:22:17 -0000	1.39
@@ -834,8 +834,9 @@
         d = self.do_getpatch("svn", "svn_trydir")
         d.addCallback(self._testTryGetPatch_1)
         return maybeWait(d)
-    def _testTryGetPatch_1(self, res):
-        baserev, (patchlevel, patch) = res
+    def _testTryGetPatch_1(self, ss):
+        baserev = ss.revision
+        (patchlevel, patch) = ss.patch
         # because of the way SVN works, the baserev we get here will be the
         # latest repository revision number, which could be either 3 or 4
         # depending upon whether the other tests (specifically 'fix') have
@@ -949,8 +950,9 @@
         d = self.do_getpatch("darcs", "darcs_trydir")
         d.addCallback(self._testTryGetPatch_1)
         return maybeWait(d)
-    def _testTryGetPatch_1(self, res):
-        baserev, (patchlevel, patch) = res
+    def _testTryGetPatch_1(self, ss):
+        baserev = ss.revision
+        (patchlevel, patch) = ss.patch
         self.failUnlessIn("[initial_import\ntest at buildbot.sf.net**", baserev,
                              "baserev was not what we expected: %s" % baserev)
         # the number of revisions depends upon whether we've run the 'fix'
@@ -1121,8 +1123,9 @@
                       self.do_getpatch("tla", "tla_trydir"))
         d.addCallback(self._testArchTryGetPatch_1)
         return maybeWait(d)
-    def _testArchTryGetPatch_1(self, res):
-        baserev, (patchlevel, patch) = res
+    def _testArchTryGetPatch_1(self, ss):
+        baserev = ss.revision
+        (patchlevel, patch) = ss.patch
         rev = "test at buildbot.sf.net--testvc/testvc--mainline--1--patch-1"
         self.failUnlessEqual(baserev, rev)
         self.failUnlessIn(newfiles['try_patch'], patch,





More information about the Commits mailing list