[Buildbot-commits] buildbot/buildbot/test runutils.py, 1.27, 1.28 test_properties.py, 1.16, 1.17

Brian Warner warner at users.sourceforge.net
Thu May 22 22:13:13 UTC 2008


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

Modified Files:
	runutils.py test_properties.py 
Log Message:
[project @ #124:global-properties.patch]
Support global properties, defined with c['properties'] = {} in master.cfg

Original author: dustin at v.igoro.us
Date: 2008-04-13 00:32:42+00:00

Index: runutils.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/runutils.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- runutils.py	22 May 2008 22:13:06 -0000	1.27
+++ runutils.py	22 May 2008 22:13:11 -0000	1.28
@@ -13,6 +13,7 @@
 from buildbot.process.buildstep import BuildStep
 from buildbot.sourcestamp import SourceStamp
 from buildbot.status import builder
+from buildbot.process.properties import Properties
 
 
 
@@ -275,6 +276,12 @@
     from buildbot.slave.registry import commandRegistry
     return commandRegistry[command]
 
+class FakeBuildMaster:
+    properties = Properties(masterprop="master")
+
+class FakeBotMaster:
+    parent = FakeBuildMaster()
+
 def makeBuildStep(basedir, step_class=BuildStep, **kwargs):
     bss = setupBuildStepStatus(basedir)
 
@@ -282,6 +289,7 @@
     setup = {'name': "builder1", "slavename": "bot1",
              'builddir': "builddir", 'factory': None}
     b0 = Builder(setup, bss.getBuild().getBuilder())
+    b0.botmaster = FakeBotMaster()
     br = BuildRequest("reason", ss)
     b = Build([br])
     b.setBuilder(b0)

Index: test_properties.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_properties.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- test_properties.py	22 May 2008 22:13:06 -0000	1.16
+++ test_properties.py	22 May 2008 22:13:11 -0000	1.17
@@ -15,9 +15,14 @@
 
 class FakeBuild:
     pass
+class FakeBuildMaster:
+    properties = Properties(masterprop="master")
+class FakeBotMaster:
+    parent = FakeBuildMaster()
 class FakeBuilder:
     statusbag = None
     name = "fakebuilder"
+    botmaster = FakeBotMaster()
 class FakeSlave:
     slavename = "bot12"
     properties = Properties()
@@ -28,7 +33,7 @@
         return "1.10"
 class FakeScheduler:
     name = "fakescheduler"
-    properties = Properties({'name' : name}, 'Scheduler')
+    properties = Properties(name=name)
 
 class TestProperties(unittest.TestCase):
     def setUp(self):
@@ -135,7 +140,7 @@
         self.build_status = self.builder_status.newBuild()
         req = base.BuildRequest("reason", 
                     SourceStamp(branch="branch2", revision="1234"),
-                    properties=Properties({"scheduler" : "fakescheduler"}, "Scheduler"))
+                    properties=Properties(scheduler="fakescheduler"))
         self.build = base.Build([req])
         self.build.build_status = self.build_status
         self.build.setBuilder(self.builder)
@@ -149,6 +154,7 @@
         self.failUnlessEqual(self.build.getProperty("slavename"), "bot12")
         self.failUnlessEqual(self.build.getProperty("buildnumber"), 5)
         self.failUnlessEqual(self.build.getProperty("buildername"), "fakebuilder")
+        self.failUnlessEqual(self.build.getProperty("masterprop"), "master")
 
 run_config = """
 from buildbot.process import factory
@@ -160,6 +166,7 @@
 c['slaves'] = [BuildSlave('bot1', 'sekrit', properties={'slprop':'slprop'})]
 c['schedulers'] = []
 c['slavePortnum'] = 0
+c['properties'] = { 'global' : 'global' }
 
 # Note: when run against twisted-1.3.0, this locks up about 5% of the time. I
 # suspect that a command with no output that finishes quickly triggers a race
@@ -170,8 +177,8 @@
 f1 = factory.BuildFactory([s(ShellCommand,
                              flunkOnFailure=True,
                              command=['touch',
-                                      WithProperties('%s-slave-%s',
-                                        'slavename', 'slprop'),
+                                      WithProperties('%s-%s-%s',
+                                        'slavename', 'global', 'slprop'),
                                       ],
                              workdir='.',
                              timeout=10,
@@ -191,7 +198,7 @@
         d.addCallback(lambda res: self.requestBuild("full1"))
         d.addCallback(self.failUnlessBuildSucceeded)
         def _check_touch(res):
-            f = os.path.join("slavebase-bot1", "bd1", "bot1-slave-slprop")
+            f = os.path.join("slavebase-bot1", "bd1", "bot1-global-slprop")
             self.failUnless(os.path.exists(f))
             return res
         d.addCallback(_check_touch)





More information about the Commits mailing list