[Buildbot-commits] buildbot/buildbot/test test_web.py,1.6,1.7
Brian Warner
warner at users.sourceforge.net
Tue Apr 19 08:22:45 UTC 2005
Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19858/buildbot/test
Modified Files:
test_web.py
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-49
Creator: Brian Warner <warner at monolith.lothar.com>
add favicon.ico, remove some deprecated web tests
2005-04-19 Brian Warner <warner at lothar.com>
* buildbot/slave/commands.py (ShellCommand._startCommand): log the
environment used by the command, at least on the child side.
* buildbot/status/html.py (TextLog.pauseProducing): add a note,
this method needs to be added and implemented because it gets
called under heavy load. I don't quite understand the
producer/consumer API enough to write it.
(StatusResource.getChild): add a resource for /favicon.ico
(Waterfall.__init__): add favicon= argument
* buildbot/test/test_web.py (WebTest.test_waterfall): test it
(WebTest.test_webPortnum): stop using deprecated 'webPortnum'
(WebTest.test_webPathname): same
(WebTest.test_webPathname_port): same
* docs/config.xhtml: mention favicon=
* buildbot/buildbot.png: add a default icon, dorky as it is
Index: test_web.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_web.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- test_web.py 2 Apr 2005 00:56:46 -0000 1.6
+++ test_web.py 19 Apr 2005 08:22:43 -0000 1.7
@@ -1,7 +1,7 @@
#! /usr/bin/python
-import sys, os
-from twisted.python import log, components
+import sys, os, os.path
+from twisted.python import log, components, util
#log.startLogging(sys.stderr)
from twisted.trial import unittest
@@ -80,10 +80,19 @@
list(master))
def test_webPortnum(self):
- cfg = config1 % {'k': 'webPortnum',
- 'v': "0"}
+ # run a regular web server on a TCP socket
+ config = """
+from buildbot.status import html
+BuildmasterConfig = {
+ 'bots': [],
+ 'sources': [],
+ 'builders': [],
+ 'slavePortnum': 0,
+ 'status': [html.Waterfall(http_port=0)],
+ }
+"""
os.mkdir("test_web1")
- m = ConfiguredMaster("test_web1", cfg)
+ m = ConfiguredMaster("test_web1", config)
m.startService()
# hack to find out what randomly-assigned port it is listening on
port = list(self.find_waterfall(m)[0])[0]._port.getHost().port
@@ -98,12 +107,18 @@
# running a t.web.distrib server over a UNIX socket
if not components.implements(reactor, IReactorUNIX):
raise unittest.SkipTest("UNIX sockets not supported here")
-
- cfg = config1 % {'k': 'webPathname',
- 'v': "'.web-pb'"}
-
+ config = """
+from buildbot.status import html
+BuildmasterConfig = {
+ 'bots': [],
+ 'sources': [],
+ 'builders': [],
+ 'slavePortnum': 0,
+ 'status': [html.Waterfall(distrib_port='.web-pb')],
+ }
+"""
os.mkdir("test_web2")
- m = ConfiguredMaster("test_web2", cfg)
+ m = ConfiguredMaster("test_web2", config)
m.startService()
p = DistribUNIX("test_web2/.web-pb")
@@ -118,11 +133,18 @@
def test_webPathname_port(self):
# running a t.web.distrib server over TCP
- cfg = config1 % {'k': 'webPathname',
- 'v': "0"}
-
+ config = """
+from buildbot.status import html
+BuildmasterConfig = {
+ 'bots': [],
+ 'sources': [],
+ 'builders': [],
+ 'slavePortnum': 0,
+ 'status': [html.Waterfall(distrib_port=0)],
+ }
+"""
os.mkdir("test_web3")
- m = ConfiguredMaster("test_web3", cfg)
+ m = ConfiguredMaster("test_web3", config)
m.startService()
dport = list(self.find_waterfall(m)[0])[0]._port.getHost().port
@@ -134,3 +156,40 @@
self.failUnless(page)
dr(p.shutdown())
dr(m.stopService())
+
+ def test_waterfall(self):
+ # this is the right way to configure the Waterfall status
+ config1 = """
+from buildbot.status import html
+BuildmasterConfig = {
+ 'bots': [],
+ 'sources': [],
+ 'builders': [],
+ 'slavePortnum': 0,
+ 'status': [html.Waterfall(http_port=0, favicon='%s')],
+ }
+"""
+ favicon = util.sibpath(__file__, "../buildbot.png")
+ #print favicon
+ cfg = config1 % os.path.abspath(favicon)
+ #print "config file is"
+ #print cfg
+
+ os.mkdir("test_web4")
+ m = ConfiguredMaster("test_web4", cfg)
+ m.startService()
+ # hack to find out what randomly-assigned port it is listening on
+ port = list(self.find_waterfall(m)[0])[0]._port.getHost().port
+
+ d = client.getPage("http://localhost:%d/" % port)
+ page = dr(d)
+ self.failUnless(page)
+ self.failUnless("current activity" in page)
+ self.failUnless("<html>" in page)
+
+ d = client.getPage("http://localhost:%d/favicon.ico" % port)
+ icon = dr(d)
+ expected = open(favicon,"r").read()
+ self.failUnless(icon == expected)
+
+ dr(m.stopService())
More information about the Commits
mailing list