[Buildbot-commits] buildbot/buildbot/test test_changes.py,1.1,1.2 test_util.py,1.1,1.2 test_mailparse.py,1.1,1.2 test_config.py,1.14,1.15 test_steps.py,1.11,1.12 test_run.py,1.23,1.24 test_maildir.py,1.3,1.4 test_vc.py,1.24,1.25 test_web.py,1.8,1.9 test_status.py,1.13,1.14 test_interlock.py,1.1,1.2 test_slavecommand.py,1.10,1.11 test_twisted.py,1.3,1.4 test_control.py,1.3,1.4

Brian Warner warner at users.sourceforge.net
Sun Apr 24 21:30:27 UTC 2005


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

Modified Files:
	test_changes.py test_util.py test_mailparse.py test_config.py 
	test_steps.py test_run.py test_maildir.py test_vc.py 
	test_web.py test_status.py test_interlock.py 
	test_slavecommand.py test_twisted.py test_control.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-83
Creator:  Brian Warner <warner at monolith.lothar.com>

Merged from org.apestaart at thomas/buildbot--waterfall--0--patch-22

Merged builder-categories and waterfall CSS work from Thomas. Also added
test-case-name tags.

Patches applied:

 * org.apestaart at thomas/buildbot--trial--0--base-0
   tag of org.apestaart at thomas/buildbot--releases--0.6.2--patch-2

 * org.apestaart at thomas/buildbot--trial--0--patch-1
   adding test-case-name

 * org.apestaart at thomas/buildbot--waterfall--0--base-0
   tag of org.apestaart at thomas/buildbot--releases--0.6.2--patch-2

 * org.apestaart at thomas/buildbot--waterfall--0--patch-1

 * org.apestaart at thomas/buildbot--waterfall--0--patch-2

 * org.apestaart at thomas/buildbot--waterfall--0--patch-3

 * org.apestaart at thomas/buildbot--waterfall--0--patch-4

 * org.apestaart at thomas/buildbot--waterfall--0--patch-5

 * org.apestaart at thomas/buildbot--waterfall--0--patch-6

 * org.apestaart at thomas/buildbot--waterfall--0--patch-7

 * org.apestaart at thomas/buildbot--waterfall--0--patch-8

 * org.apestaart at thomas/buildbot--waterfall--0--patch-9
   merge for test-case-name

 * org.apestaart at thomas/buildbot--waterfall--0--patch-10
   unittests + fixes for status.mail category filtering

 * org.apestaart at thomas/buildbot--waterfall--0--patch-11
   fix testsuite by prefixing page title with BuildBot

 * org.apestaart at thomas/buildbot--waterfall--0--patch-12
   move category from Builder to BuilderStatus

 * org.apestaart at thomas/buildbot--waterfall--0--patch-13
   fix silly bug, makes order in waterfall work again

 * org.apestaart at thomas/buildbot--waterfall--0--patch-14
   document category and categories for builders and statusclients

 * org.apestaart at thomas/buildbot--waterfall--0--patch-15
   remove prints from test_run

 * org.apestaart at thomas/buildbot--waterfall--0--patch-16
   remove FIXME and unneeded code for category

 * org.apestaart at thomas/buildbot--waterfall--0--patch-17
   put back "builders" argument

 * org.apestaart at thomas/buildbot--waterfall--0--patch-18
   use class_ to assign a class="" to the html blocks

 * org.apestaart at thomas/buildbot--waterfall--0--patch-19
   cssclass->class_

 * org.apestaart at thomas/buildbot--waterfall--0--patch-20
   give classes names as agreed

 * org.apestaart at thomas/buildbot--waterfall--0--patch-21
   finish class styling and add EXCEPTION result

 * org.apestaart at thomas/buildbot--waterfall--0--patch-22
   classic buildbot stylesheet


Index: test_changes.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_changes.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_changes.py	29 Apr 2004 22:46:31 -0000	1.1
+++ test_changes.py	24 Apr 2005 21:30:25 -0000	1.2
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_changes -*-
 
 from twisted.trial import unittest
 

Index: test_config.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_config.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- test_config.py	23 Apr 2005 10:22:11 -0000	1.14
+++ test_config.py	24 Apr 2005 21:30:25 -0000	1.15
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_config -*-
 
 from __future__ import generators
 import os, os.path

Index: test_control.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_control.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test_control.py	30 Sep 2004 07:13:32 -0000	1.3
+++ test_control.py	24 Apr 2005 21:30:25 -0000	1.4
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_control -*-
 
 import sys, os, signal, shutil, time
 

Index: test_interlock.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_interlock.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_interlock.py	8 Jan 2004 20:05:24 -0000	1.1
+++ test_interlock.py	24 Apr 2005 21:30:25 -0000	1.2
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_interlock -*-
 
 from twisted.trial import unittest
 from buildbot.process.interlock import Interlock

Index: test_maildir.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_maildir.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test_maildir.py	8 Nov 2004 09:03:20 -0000	1.3
+++ test_maildir.py	24 Apr 2005 21:30:25 -0000	1.4
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_maildir -*-
 
 from twisted.trial import unittest
 import os, shutil

Index: test_mailparse.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_mailparse.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_mailparse.py	8 Jan 2004 20:05:24 -0000	1.1
+++ test_mailparse.py	24 Apr 2005 21:30:25 -0000	1.2
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_mailparse -*-
 
 import os.path
 from twisted.trial import unittest

Index: test_run.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_run.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- test_run.py	22 Apr 2005 21:29:20 -0000	1.23
+++ test_run.py	24 Apr 2005 21:30:25 -0000	1.24
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_run -*-
 
 from twisted.trial import unittest
 dr = unittest.deferredResult
@@ -50,12 +50,60 @@
 c['bots'] = [['bot1', 'sekrit']]
 c['sources'] = []
 c['builders'] = [{'name': 'dummy', 'slavename': 'bot1',
+                  'builddir': 'dummy1', 'factory': f1},
+                 {'name': 'testdummy', 'slavename': 'bot1',
+                  'builddir': 'dummy2', 'factory': f1, 'category': 'test'}]
+c['slavePortnum'] = 0
+BuildmasterConfig = c
+"""
+
+config_3 = """
+from buildbot.process import factory, step
+
+def s(klass, **kwargs):
+    return (klass, kwargs)
+
+f1 = factory.BuildFactory([
+    s(step.Dummy, timeout=1),
+    s(step.RemoteDummy, timeout=2),
+    ])
+c = {}
+c['bots'] = [['bot1', 'sekrit']]
+c['sources'] = []
+c['builders'] = [
+                 {'name': 'dummy', 'slavename': 'bot1',
+                  'builddir': 'dummy1', 'factory': f1},
+                 {'name': 'testdummy', 'slavename': 'bot1',
+                  'builddir': 'dummy2', 'factory': f1, 'category': 'test'},
+                 {'name': 'adummy', 'slavename': 'bot1',
+                  'builddir': 'adummy3', 'factory': f1},
+                 {'name': 'bdummy', 'slavename': 'bot1',
+                  'builddir': 'adummy4', 'factory': f1, 'category': 'test'},
+]
+c['slavePortnum'] = 0
+BuildmasterConfig = c
+"""
+
+config_4 = """
+from buildbot.process import factory, step
+
+def s(klass, **kwargs):
+    return (klass, kwargs)
+
+f1 = factory.BuildFactory([
+    s(step.Dummy, timeout=1),
+    s(step.RemoteDummy, timeout=2),
+    ])
+c = {}
+c['bots'] = [['bot1', 'sekrit']]
+c['sources'] = []
+c['builders'] = [{'name': 'dummy', 'slavename': 'bot1',
                   'builddir': 'dummy', 'factory': f1}]
 c['slavePortnum'] = 0
 BuildmasterConfig = c
 """
 
-config_2_newbasedir = """
+config_4_newbasedir = """
 from buildbot.process import factory, step
 
 def s(klass, **kwargs):
@@ -169,7 +217,7 @@
         os.mkdir("basedir")
         self.master = master.BuildMaster("basedir")
 
-    def connectSlave(self):
+    def connectSlave(self, builders=["dummy"]):
         port = self.master.slavePort._port.getHost().port
         os.mkdir("slavebase")
         slave = MyBuildSlave("localhost", port, "bot1", "sekrit",
@@ -177,7 +225,12 @@
         slave.info = {"admin": "one"}
         self.slave = slave
         slave.startService()
-        d = self.master.botmaster.waitUntilBuilderAttached("dummy")
+        dl = []
+        # initiate call for all of them, before waiting on result,
+        # otherwise we might miss some
+        for b in builders:
+            dl.append(self.master.botmaster.waitUntilBuilderAttached(b))
+        d = defer.DeferredList(dl)
         dr(d)
 
     def connectSlave2(self):
@@ -286,13 +339,20 @@
         m.readConfig = True
         m.startService()
 
-        self.failUnlessEqual(len(t1.events), 2)
+        self.failUnlessEqual(len(t1.events), 4)
         self.failUnlessEqual(t1.events[0][0:2], ("builderAdded", "dummy"))
         self.failUnlessEqual(t1.events[1],
-                             ("builderChangedState", "dummy", "offline", None))
+                             ("builderChangedState", "dummy", "offline",
+                              None))
+        self.failUnlessEqual(t1.events[2][0:2], ("builderAdded", "testdummy"))
+        self.failUnlessEqual(t1.events[3],
+                             ("builderChangedState", "testdummy", "offline",
+                              None))
         t1.events = []
 
-        self.failUnlessEqual(s.getBuilderNames(), ["dummy"])
+        self.failUnlessEqual(s.getBuilderNames(), ["dummy", "testdummy"])
+        self.failUnlessEqual(s.getBuilderNames(categories=['test']),
+                             ["testdummy"])
         s1 = s.getBuilder("dummy")
         self.failUnlessEqual(s1.getName(), "dummy")
         self.failUnlessEqual(s1.getState(), ("offline", None, None))
@@ -302,17 +362,21 @@
         #self.failUnlessEqual(s1.getEvent(-1), foo("created"))
 
         # status targets should, upon being subscribed, immediately get a
-        # list of all current builders
+        # list of all current builders matching their category
         t2 = STarget([])
         s.subscribe(t2)
-        self.failUnlessEqual(len(t2.events), 1)
+        self.failUnlessEqual(len(t2.events), 2)
         self.failUnlessEqual(t2.events[0][0:2], ("builderAdded", "dummy"))
+        self.failUnlessEqual(t2.events[1][0:2], ("builderAdded", "testdummy"))
 
-        self.connectSlave()
+        self.connectSlave(builders=["dummy", "testdummy"])
 
-        self.failUnlessEqual(len(t1.events), 1)
+        self.failUnlessEqual(len(t1.events), 2)
         self.failUnlessEqual(t1.events[0],
                              ("builderChangedState", "dummy", "idle", None))
+        self.failUnlessEqual(t1.events[1],
+                             ("builderChangedState", "testdummy", "idle",
+                              None))
         t1.events = []
 
         c = interfaces.IControl(m)
@@ -335,6 +399,9 @@
         self.failUnlessEqual([ev[0] for ev in t3.events],
                              ["builderAdded",
                               "builderChangedState", # offline
+                              "builderAdded",
+                              "builderChangedState", # idle
+                              "builderChangedState", # offline
                               "builderChangedState", # idle
                               "builderChangedState", # building
                               "buildStarted",
@@ -395,6 +462,20 @@
 
         self.failUnless(3.0 < t4.eta_build < 5.0) # should be 4 seconds
 
+class BuilderNames(unittest.TestCase):
+
+    def testGetBuilderNames(self):
+        m = master.BuildMaster("/tmp")
+        s = m.getStatus()
+
+        m.loadConfig(config_3)
+        m.readConfig = True
+
+        self.failUnlessEqual(s.getBuilderNames(),
+                             ["dummy", "testdummy", "adummy", "bdummy"])
+        self.failUnlessEqual(s.getBuilderNames(categories=['test']),
+                             ["testdummy", "bdummy"])
+
 class Disconnect(RunMixin, unittest.TestCase):
 
     def disconnectSetupMaster(self):
@@ -408,7 +489,7 @@
         m.readConfig = True
         m.startService()
 
-        self.failUnlessEqual(s.getBuilderNames(), ["dummy"])
+        self.failUnlessEqual(s.getBuilderNames(), ["dummy", "testdummy"])
         s1 = s.getBuilder("dummy")
         self.failUnlessEqual(s1.getName(), "dummy")
         self.failUnlessEqual(s1.getState(), ("offline", None, None))
@@ -598,6 +679,10 @@
         reactor.callLater(1.5, self.killSlave)
 
         dr(bs.waitUntilFinished(), 5)
+        # at this point, the slave is in the process of being removed, so it
+        # could either be 'idle' or 'offline'. I think there is a
+        # reactor.callLater(0) standing between here and the offline state.
+        reactor.iterate() # TODO: remove the need for this
 
         self.failUnlessEqual(s1.getState()[0], "offline")
         self.verifyDisconnect2(bs)
@@ -663,7 +748,7 @@
 class Basedir(RunMixin, unittest.TestCase):
     def testChangeBuilddir(self):
         m = self.master
-        m.loadConfig(config_2)
+        m.loadConfig(config_4)
         m.readConfig = True
         m.startService()
         
@@ -674,7 +759,7 @@
         self.failUnlessEqual(builder.builddir, "dummy")
         self.failUnlessEqual(builder.basedir, "slavebase/dummy")
 
-        d = m.loadConfig(config_2_newbasedir)
+        d = m.loadConfig(config_4_newbasedir)
         dr(d)
 
         # this causes the builder to be replaced

Index: test_slavecommand.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_slavecommand.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- test_slavecommand.py	23 Apr 2005 10:38:31 -0000	1.10
+++ test_slavecommand.py	24 Apr 2005 21:30:25 -0000	1.11
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_slavecommand -*-
 
 from twisted.trial import unittest
 from twisted.internet import reactor, defer

Index: test_status.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_status.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- test_status.py	11 Nov 2004 20:47:14 -0000	1.13
+++ test_status.py	24 Apr 2005 21:30:25 -0000	1.14
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_status -*-
 
 import email, os
 
@@ -49,7 +49,7 @@
     __implements__ = interfaces.IEmailLookup,
     def getAddress(self, user):
         d = defer.Deferred()
-        # With me now is Mr Thomas Walters of West Hartlepool who is totall
+        # With me now is Mr Thomas Walters of West Hartlepool who is totally
         # invisible.
         if user == "Thomas_Walters":
             d.callback(None)
@@ -119,6 +119,78 @@
         self.failUnlessIn("Build succeeded!\n", t)
         self.failUnlessIn("Buildbot URL: BUILDBOT_URL\n", t)
 
+    def testBuildStatusCategory(self):
+        # a status client only interested in a category should only receive
+        # from that category
+        mailer = MyMailer(fromaddr="buildbot at example.com",
+                          extraRecipients=["recip at example.com",
+                                           "recip2 at example.com"],
+                          lookup="dev.com",
+                          sendToInterestedUsers=False,
+                          categories=["debug"])
+
+        mailer.parent = self
+        mailer.status = self
+        self.messages = []
+
+        b1 = self.makeBuild(3, builder.SUCCESS)
+        b1.blamelist = ["bob"]
+
+        mailer.buildFinished("builder1", b1, b1.results)
+        self.failIf(self.messages)
+
+    def testBuilderCategory(self):
+        # a builder in a certain category should notify status clients that
+        # did not list categories, or categories including this one
+        mailer1 = MyMailer(fromaddr="buildbot at example.com",
+                           extraRecipients=["recip at example.com",
+                                            "recip2 at example.com"],
+                           lookup="dev.com",
+                           sendToInterestedUsers=False)
+        mailer2 = MyMailer(fromaddr="buildbot at example.com",
+                           extraRecipients=["recip at example.com",
+                                            "recip2 at example.com"],
+                           lookup="dev.com",
+                           sendToInterestedUsers=False,
+                           categories=["active"])
+        mailer3 = MyMailer(fromaddr="buildbot at example.com",
+                           extraRecipients=["recip at example.com",
+                                            "recip2 at example.com"],
+                           lookup="dev.com",
+                           sendToInterestedUsers=False,
+                           categories=["active", "debug"])
+
+        builderd = MyBuilder("builder2", "debug")
+
+        mailer1.parent = self
+        mailer1.status = self
+        mailer2.parent = self
+        mailer2.status = self
+        mailer3.parent = self
+        mailer3.status = self
+        self.messages = []
+
+        t = mailer1.builderAdded("builder2", builderd)
+        self.assertEqual(len(mailer1.watched), 1)
+        self.assertEqual(t, mailer1)
+        t = mailer2.builderAdded("builder2", builderd)
+        self.assertEqual(len(mailer2.watched), 0)
+        self.assertEqual(t, None)
+        t = mailer3.builderAdded("builder2", builderd)
+        self.assertEqual(len(mailer3.watched), 1)
+        self.assertEqual(t, mailer3)
+
+        b2 = MyBuild(builderd, 3, builder.SUCCESS)
+        b2.blamelist = ["bob"]
+
+        mailer1.buildFinished("builder2", b2, b2.results)
+        self.failUnlessEqual(len(self.messages), 1)
+        self.messages = []
+        mailer2.buildFinished("builder2", b2, b2.results)
+        self.failUnlessEqual(len(self.messages), 0)
+        self.messages = []
+        mailer3.buildFinished("builder2", b2, b2.results)
+        self.failUnlessEqual(len(self.messages), 1)
 
     def testFailure(self):
         mailer = MyMailer(fromaddr="buildbot at example.com", mode="problem",

Index: test_steps.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_steps.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- test_steps.py	12 Sep 2004 05:12:27 -0000	1.11
+++ test_steps.py	24 Apr 2005 21:30:25 -0000	1.12
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_steps -*-
 
 # create the BuildStep with a fake .remote instance that logs the
 # .callRemote invocations and compares them against the expected calls. Then

Index: test_twisted.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_twisted.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test_twisted.py	15 Oct 2004 18:44:18 -0000	1.3
+++ test_twisted.py	24 Apr 2005 21:30:25 -0000	1.4
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_twisted -*-
 
 from twisted.trial import unittest
 

Index: test_util.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_util.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_util.py	30 Aug 2004 00:13:40 -0000	1.1
+++ test_util.py	24 Apr 2005 21:30:25 -0000	1.2
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_util -*-
 
 from twisted.trial import unittest
 

Index: test_vc.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_vc.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- test_vc.py	23 Apr 2005 10:47:53 -0000	1.24
+++ test_vc.py	24 Apr 2005 21:30:25 -0000	1.25
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_vc -*-
 
 import sys, os, signal, shutil, time
 from email.Utils import mktime_tz, parsedate_tz

Index: test_web.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_web.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- test_web.py	20 Apr 2005 20:13:26 -0000	1.8
+++ test_web.py	24 Apr 2005 21:30:25 -0000	1.9
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+# -*- test-case-name: buildbot.test.test_web -*-
 
 import sys, os, os.path
 from twisted.python import log, components, util





More information about the Commits mailing list