[Buildbot-commits] buildbot/buildbot/test runutils.py, 1.26, 1.27 test_properties.py, 1.15, 1.16
Brian Warner
warner at users.sourceforge.net
Thu May 22 22:13:09 UTC 2008
Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17543/buildbot/test
Modified Files:
runutils.py test_properties.py
Log Message:
[project @ #124:scheduler-properties.patch]
Arrange for properties to come down from schedulers, via BuildStep and
BuildRequest objects. custom_props are still present, in parallel, but
will go eventually. Triggered builds no longer propagate custom props.
Original author: dustin at v.igoro.us
Date: 2008-04-12 23:46:58+00:00
Index: runutils.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/runutils.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- runutils.py 22 Mar 2008 22:14:16 -0000 1.26
+++ runutils.py 22 May 2008 22:13:06 -0000 1.27
@@ -152,7 +152,7 @@
if bs.getResults() != builder.SUCCESS:
log.msg("failUnlessBuildSucceeded noticed that the build failed")
self.logBuildResults(bs)
- self.failUnless(bs.getResults() == builder.SUCCESS)
+ self.failUnlessEqual(bs.getResults(), builder.SUCCESS)
return bs # useful for chaining
def logBuildResults(self, bs):
@@ -288,7 +288,8 @@
s = step_class(**kwargs)
s.setBuild(b)
s.setStepStatus(bss)
- b.setupStatus(bss.getBuild())
+ b.build_status = bss.getBuild()
+ b.setupProperties()
s.slaveVersion = fake_slaveVersion
return s
Index: test_properties.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_properties.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- test_properties.py 22 May 2008 22:13:02 -0000 1.15
+++ test_properties.py 22 May 2008 22:13:06 -0000 1.16
@@ -20,12 +20,15 @@
name = "fakebuilder"
class FakeSlave:
slavename = "bot12"
+ properties = Properties()
+ properties.setProperty("slavename", slavename, "BuildSlave")
class FakeSlaveBuilder:
slave = FakeSlave()
def getSlaveCommandVersion(self, command, oldversion=None):
return "1.10"
class FakeScheduler:
name = "fakescheduler"
+ properties = Properties({'name' : name}, 'Scheduler')
class TestProperties(unittest.TestCase):
def setUp(self):
@@ -130,43 +133,23 @@
rmdirRecursive(self.builder_status.basedir)
os.mkdir(self.builder_status.basedir)
self.build_status = self.builder_status.newBuild()
- req = base.BuildRequest("reason", SourceStamp(branch="branch2",
- revision="1234"))
+ req = base.BuildRequest("reason",
+ SourceStamp(branch="branch2", revision="1234"),
+ properties=Properties({"scheduler" : "fakescheduler"}, "Scheduler"))
self.build = base.Build([req])
+ self.build.build_status = self.build_status
self.build.setBuilder(self.builder)
- self.build.setupStatus(self.build_status)
+ self.build.setupProperties()
self.build.setupSlaveBuilder(FakeSlaveBuilder())
def testProperties(self):
- # if not started from a scheduler, the 'scheduler' property
- # should be 'none'
- self.failUnlessEqual(self.build.getProperty("scheduler"), "none")
+ self.failUnlessEqual(self.build.getProperty("scheduler"), "fakescheduler")
self.failUnlessEqual(self.build.getProperty("branch"), "branch2")
self.failUnlessEqual(self.build.getProperty("revision"), "1234")
self.failUnlessEqual(self.build.getProperty("slavename"), "bot12")
self.failUnlessEqual(self.build.getProperty("buildnumber"), 5)
self.failUnlessEqual(self.build.getProperty("buildername"), "fakebuilder")
-class SchedulerTest(unittest.TestCase):
- def setUp(self):
- self.builder = FakeBuilder()
- self.builder_status = builder.BuilderStatus("fakebuilder")
- self.builder_status.basedir = "test_properties"
- self.builder_status.nextBuildNumber = 5
- rmdirRecursive(self.builder_status.basedir)
- os.mkdir(self.builder_status.basedir)
- self.build_status = self.builder_status.newBuild()
- req = base.BuildRequest("reason", SourceStamp(branch="branch2",
- revision=1234), scheduler=FakeScheduler())
- self.build = base.Build([req])
- self.build.setBuilder(self.builder)
- self.build.setupStatus(self.build_status)
- self.build.setupSlaveBuilder(FakeSlaveBuilder())
-
- def testWithScheduler(self):
- self.failUnlessEqual(self.build.getProperty("scheduler"),
- "fakescheduler")
-
run_config = """
from buildbot.process import factory
from buildbot.steps.shell import ShellCommand, WithProperties
@@ -174,7 +157,7 @@
s = factory.s
BuildmasterConfig = c = {}
-c['slaves'] = [BuildSlave('bot1', 'sekrit')]
+c['slaves'] = [BuildSlave('bot1', 'sekrit', properties={'slprop':'slprop'})]
c['schedulers'] = []
c['slavePortnum'] = 0
@@ -187,7 +170,8 @@
f1 = factory.BuildFactory([s(ShellCommand,
flunkOnFailure=True,
command=['touch',
- WithProperties('%s-slave', 'slavename'),
+ WithProperties('%s-slave-%s',
+ 'slavename', 'slprop'),
],
workdir='.',
timeout=10,
@@ -207,7 +191,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")
+ f = os.path.join("slavebase-bot1", "bd1", "bot1-slave-slprop")
self.failUnless(os.path.exists(f))
return res
d.addCallback(_check_touch)
More information about the Commits
mailing list