[Buildbot-commits] buildbot/buildbot/test test_config.py,1.33,1.34

Brian Warner warner at users.sourceforge.net
Fri Jan 13 08:34:31 UTC 2006


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

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

all port= args now accept a strports string: slaveport, Waterfall, etc

	* buildbot/master.py (Manhole.__init__): let port= be a strports
	specification string, but handle a regular int for backwards
	compatibility. This allows "tcp:12345:interface=127.0.0.1" to be
	used in master.cfg to limit connections to just the local host.
	(BuildMaster.loadConfig): same for c['slavePortnum']
	* buildbot/scheduler.py (Try_Userpass.__init__): same
	* buildbot/status/client.py (PBListener.__init__): same
	* buildbot/status/html.py (Waterfall.__init__): same, for both
	http_port and distrib_port. Include backwards-compatibility checks
	so distrib_port can be a filename string and still mean unix:/foo
	* docs/buildbot.texinfo (Setting the slaveport): document it
	(Debug options): same
	(HTML Waterfall): same
	(PBListener): same
	(try): same
	* buildbot/test/test_config.py (ConfigTest): test it

	* buildbot/master.py (BuildMaster.loadConfig): wait for the
	slaveport's disownServiceParent deferred to fire before opening
	the new one. Fixes an annoying bug in the unit tests.


Index: test_config.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_config.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- test_config.py	3 Jan 2006 09:26:41 -0000	1.33
+++ test_config.py	13 Jan 2006 08:34:29 -0000	1.34
@@ -112,6 +112,12 @@
 c['status'] = [html.Waterfall(http_port=9981)]
 """
 
+webCfg3 = emptyCfg + \
+"""
+from buildbot.status import html
+c['status'] = [html.Waterfall(http_port='tcp:9981:interface=127.0.0.1')]
+"""
+
 webNameCfg1 = emptyCfg + \
 """
 from buildbot.status import html
@@ -121,7 +127,7 @@
 webNameCfg2 = emptyCfg + \
 """
 from buildbot.status import html
-c['status'] = [html.Waterfall(distrib_port='bar.socket')]
+c['status'] = [html.Waterfall(distrib_port='./bar.socket')]
 """
 
 debugPasswordCfg = emptyCfg + \
@@ -396,7 +402,7 @@
         master.loadConfig(emptyCfg)
         # note: this doesn't actually start listening, because the app
         # hasn't been started running
-        self.failUnlessEqual(master.slavePortnum, 9999)
+        self.failUnlessEqual(master.slavePortnum, "tcp:9999")
         self.checkPorts(master, [(9999, pb.PBServerFactory)])
         self.failUnlessEqual(list(master.change_svc), [])
         self.failUnlessEqual(master.botmaster.builders, {})
@@ -412,19 +418,19 @@
         master.loadChanges()
 
         master.loadConfig(emptyCfg)
-        self.failUnlessEqual(master.slavePortnum, 9999)
+        self.failUnlessEqual(master.slavePortnum, "tcp:9999")
         ports = self.checkPorts(master, [(9999, pb.PBServerFactory)])
         p = ports[0]
 
         master.loadConfig(emptyCfg)
-        self.failUnlessEqual(master.slavePortnum, 9999)
+        self.failUnlessEqual(master.slavePortnum, "tcp:9999")
         ports = self.checkPorts(master, [(9999, pb.PBServerFactory)])
         self.failUnlessIdentical(p, ports[0],
                                  "the slave port was changed even " + \
                                  "though the configuration was not")
 
         master.loadConfig(emptyCfg + "c['slavePortnum'] = 9000\n")
-        self.failUnlessEqual(master.slavePortnum, 9000)
+        self.failUnlessEqual(master.slavePortnum, "tcp:9000")
         ports = self.checkPorts(master, [(9000, pb.PBServerFactory)])
         self.failIf(p is ports[0],
                     "slave port was unchanged but configuration was changed")
@@ -738,8 +744,14 @@
         ports = self.checkPorts(self.buildmaster, [(9999, pb.PBServerFactory),
                                                    (9981, Site)])
         self.failIf(p is ports[1],
-                    "web port was unchanged but configuration was changed")
-
+                    "configuration was changed but web port was unchanged")
+        d = self.buildmaster.loadConfig(webCfg3) # 9981 on only localhost
+        d.addCallback(self._testWebPortnum_4, ports[1])
+        return d
+    def _testWebPortnum_4(self, res, p):
+        ports = self.checkPorts(self.buildmaster, [(9999, pb.PBServerFactory),
+                                                   (9981, Site)])
+        self.failUnlessEqual(ports[1].kwargs['interface'], "127.0.0.1")
         d = self.buildmaster.loadConfig(emptyCfg)
         d.addCallback(lambda res:
                       self.checkPorts(self.buildmaster,
@@ -780,7 +792,7 @@
     def _testWebPathname_3(self, res, f):
         self.checkPorts(self.buildmaster,
                         [(9999, pb.PBServerFactory),
-                         ('bar.socket', pb.PBServerFactory)])
+                         ('./bar.socket', pb.PBServerFactory)])
         self.failIf(f is self.UNIXports(self.buildmaster)[0].args[1],
                     "web factory was unchanged but configuration was changed")
 
@@ -883,11 +895,11 @@
 
         m = BuildMaster("test_cf")
         m.loadTheConfigFile()
-        self.failUnlessEqual(m.slavePortnum, 9999)
+        self.failUnlessEqual(m.slavePortnum, "tcp:9999")
 
         m = BuildMaster("test_cf", "alternate.cfg")
         m.loadTheConfigFile()
-        self.failUnlessEqual(m.slavePortnum, 9000)
+        self.failUnlessEqual(m.slavePortnum, "tcp:9000")
 
 
 class MyTarget(base.StatusReceiverMultiService):





More information about the Commits mailing list