本文整理汇总了Python中buildbot.process.botmaster.BotMaster.maybeStartBuildsForSlave方法的典型用法代码示例。如果您正苦于以下问题:Python BotMaster.maybeStartBuildsForSlave方法的具体用法?Python BotMaster.maybeStartBuildsForSlave怎么用?Python BotMaster.maybeStartBuildsForSlave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildbot.process.botmaster.BotMaster
的用法示例。
在下文中一共展示了BotMaster.maybeStartBuildsForSlave方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestBotMaster
# 需要导入模块: from buildbot.process.botmaster import BotMaster [as 别名]
# 或者: from buildbot.process.botmaster.BotMaster import maybeStartBuildsForSlave [as 别名]
class TestBotMaster(unittest.TestCase):
def setUp(self):
self.botmaster = BotMaster(mock.Mock())
def test_maybeStartBuildsForBuilder(self):
brd = self.botmaster.brd = mock.Mock()
self.botmaster.maybeStartBuildsForBuilder('frank')
brd.maybeStartBuildsOn.assert_called_once_with(['frank'])
def test_maybeStartBuildsForSlave(self):
brd = self.botmaster.brd = mock.Mock()
b1 = mock.Mock(name='frank')
b1.name = 'frank'
b2 = mock.Mock(name='larry')
b2.name = 'larry'
self.botmaster.getBuildersForSlave = mock.Mock(return_value=[b1, b2])
self.botmaster.maybeStartBuildsForSlave('centos')
self.botmaster.getBuildersForSlave.assert_called_once_with('centos')
brd.maybeStartBuildsOn.assert_called_once_with(['frank', 'larry'])
def test_maybeStartBuildsForAll(self):
brd = self.botmaster.brd = mock.Mock()
self.botmaster.builderNames = ['frank', 'larry']
self.botmaster.maybeStartBuildsForAllBuilders()
brd.maybeStartBuildsOn.assert_called_once_with(['frank', 'larry'])
示例2: TestBotMaster
# 需要导入模块: from buildbot.process.botmaster import BotMaster [as 别名]
# 或者: from buildbot.process.botmaster.BotMaster import maybeStartBuildsForSlave [as 别名]
class TestBotMaster(unittest.TestCase):
def setUp(self):
self.master = fakemaster.make_master(testcase=self, wantMq=True,
wantData=True)
self.master.mq = self.master.mq
self.botmaster = BotMaster(self.master)
self.new_config = mock.Mock()
self.botmaster.startService()
def tearDown(self):
return self.botmaster.stopService()
def test_reconfigService(self):
# check that reconfigServiceBuilders is called.
self.patch(self.botmaster, 'reconfigServiceBuilders',
mock.Mock(side_effect=lambda c: defer.succeed(None)))
self.patch(self.botmaster, 'maybeStartBuildsForAllBuilders',
mock.Mock())
new_config = mock.Mock()
d = self.botmaster.reconfigService(new_config)
@d.addCallback
def check(_):
self.botmaster.reconfigServiceBuilders.assert_called_with(
new_config)
self.assertTrue(
self.botmaster.maybeStartBuildsForAllBuilders.called)
return d
@defer.inlineCallbacks
def test_reconfigServiceBuilders_add_remove(self):
bc = config.BuilderConfig(name='bldr', factory=factory.BuildFactory(),
slavename='f')
self.new_config.builders = [bc]
yield self.botmaster.reconfigServiceBuilders(self.new_config)
bldr = self.botmaster.builders['bldr']
self.assertIdentical(bldr.parent, self.botmaster)
self.assertIdentical(bldr.master, self.master)
self.assertEqual(self.botmaster.builderNames, ['bldr'])
self.new_config.builders = []
yield self.botmaster.reconfigServiceBuilders(self.new_config)
self.assertIdentical(bldr.parent, None)
self.assertIdentical(bldr.master, None)
self.assertEqual(self.botmaster.builders, {})
self.assertEqual(self.botmaster.builderNames, [])
def test_maybeStartBuildsForBuilder(self):
brd = self.botmaster.brd = mock.Mock()
self.botmaster.maybeStartBuildsForBuilder('frank')
brd.maybeStartBuildsOn.assert_called_once_with(['frank'])
def test_maybeStartBuildsForSlave(self):
brd = self.botmaster.brd = mock.Mock()
b1 = mock.Mock(name='frank')
b1.name = 'frank'
b2 = mock.Mock(name='larry')
b2.name = 'larry'
self.botmaster.getBuildersForSlave = mock.Mock(return_value=[b1, b2])
self.botmaster.maybeStartBuildsForSlave('centos')
self.botmaster.getBuildersForSlave.assert_called_once_with('centos')
brd.maybeStartBuildsOn.assert_called_once_with(['frank', 'larry'])
def test_maybeStartBuildsForAll(self):
brd = self.botmaster.brd = mock.Mock()
self.botmaster.builderNames = ['frank', 'larry']
self.botmaster.maybeStartBuildsForAllBuilders()
brd.maybeStartBuildsOn.assert_called_once_with(['frank', 'larry'])
示例3: TestBotMaster
# 需要导入模块: from buildbot.process.botmaster import BotMaster [as 别名]
# 或者: from buildbot.process.botmaster.BotMaster import maybeStartBuildsForSlave [as 别名]
#.........这里部分代码省略.........
self.assertIdentical(sl.parent, self.botmaster)
self.assertEqual(self.botmaster.slaves, {"sl1": sl})
self.new_config.slaves = []
wfd = defer.waitForDeferred(self.botmaster.reconfigServiceSlaves(self.new_config))
yield wfd
wfd.getResult()
self.assertIdentical(sl.parent, None)
self.assertIdentical(sl.master, None)
@defer.deferredGenerator
def test_reconfigServiceSlaves_reconfig(self):
sl = FakeBuildSlave("sl1")
self.botmaster.slaves = dict(sl1=sl)
sl.setServiceParent(self.botmaster)
sl.master = self.master
sl.botmaster = self.botmaster
sl_new = FakeBuildSlave("sl1")
self.new_config.slaves = [sl_new]
wfd = defer.waitForDeferred(self.botmaster.reconfigServiceSlaves(self.new_config))
yield wfd
wfd.getResult()
# sl was not replaced..
self.assertIdentical(self.botmaster.slaves["sl1"], sl)
@defer.deferredGenerator
def test_reconfigServiceSlaves_class_changes(self):
sl = FakeBuildSlave("sl1")
self.botmaster.slaves = dict(sl1=sl)
sl.setServiceParent(self.botmaster)
sl.master = self.master
sl.botmaster = self.botmaster
sl_new = FakeBuildSlave2("sl1")
self.new_config.slaves = [sl_new]
wfd = defer.waitForDeferred(self.botmaster.reconfigServiceSlaves(self.new_config))
yield wfd
wfd.getResult()
# sl *was* replaced (different class)
self.assertIdentical(self.botmaster.slaves["sl1"], sl_new)
@defer.deferredGenerator
def test_reconfigServiceBuilders_add_remove(self):
bc = config.BuilderConfig(name="bldr", factory=mock.Mock(), slavename="f")
self.new_config.builders = [bc]
wfd = defer.waitForDeferred(self.botmaster.reconfigServiceBuilders(self.new_config))
yield wfd
wfd.getResult()
bldr = self.botmaster.builders["bldr"]
self.assertIdentical(bldr.parent, self.botmaster)
self.assertIdentical(bldr.master, self.master)
self.assertEqual(self.botmaster.builderNames, ["bldr"])
self.new_config.builders = []
wfd = defer.waitForDeferred(self.botmaster.reconfigServiceBuilders(self.new_config))
yield wfd
wfd.getResult()
self.assertIdentical(bldr.parent, None)
self.assertIdentical(bldr.master, None)
self.assertEqual(self.botmaster.builders, {})
self.assertEqual(self.botmaster.builderNames, [])
def test_maybeStartBuildsForBuilder(self):
brd = self.botmaster.brd = mock.Mock()
self.botmaster.maybeStartBuildsForBuilder("frank")
brd.maybeStartBuildsOn.assert_called_once_with(["frank"])
def test_maybeStartBuildsForSlave(self):
brd = self.botmaster.brd = mock.Mock()
b1 = mock.Mock(name="frank")
b1.name = "frank"
b2 = mock.Mock(name="larry")
b2.name = "larry"
self.botmaster.getBuildersForSlave = mock.Mock(return_value=[b1, b2])
self.botmaster.maybeStartBuildsForSlave("centos")
self.botmaster.getBuildersForSlave.assert_called_once_with("centos")
brd.maybeStartBuildsOn.assert_called_once_with(["frank", "larry"])
def test_maybeStartBuildsForAll(self):
brd = self.botmaster.brd = mock.Mock()
self.botmaster.builderNames = ["frank", "larry"]
self.botmaster.maybeStartBuildsForAllBuilders()
brd.maybeStartBuildsOn.assert_called_once_with(["frank", "larry"])
示例4: TestBotMaster
# 需要导入模块: from buildbot.process.botmaster import BotMaster [as 别名]
# 或者: from buildbot.process.botmaster.BotMaster import maybeStartBuildsForSlave [as 别名]
#.........这里部分代码省略.........
return d
@defer.inlineCallbacks
def test_reconfigServiceSlaves_add_remove(self):
sl = FakeBuildSlave('sl1')
self.new_config.slaves = [ sl ]
yield self.botmaster.reconfigServiceSlaves(self.new_config)
self.assertIdentical(sl.parent, self.botmaster)
self.assertEqual(self.botmaster.slaves, { 'sl1' : sl })
self.new_config.slaves = [ ]
yield self.botmaster.reconfigServiceSlaves(self.new_config)
self.assertIdentical(sl.parent, None)
self.assertIdentical(sl.master, None)
@defer.inlineCallbacks
def test_reconfigServiceSlaves_reconfig(self):
sl = FakeBuildSlave('sl1')
self.botmaster.slaves = dict(sl1=sl)
sl.setServiceParent(self.botmaster)
sl.master = self.master
sl.botmaster = self.botmaster
sl_new = FakeBuildSlave('sl1')
self.new_config.slaves = [ sl_new ]
yield self.botmaster.reconfigServiceSlaves(self.new_config)
# sl was not replaced..
self.assertIdentical(self.botmaster.slaves['sl1'], sl)
@defer.inlineCallbacks
def test_reconfigServiceSlaves_class_changes(self):
sl = FakeBuildSlave('sl1')
self.botmaster.slaves = dict(sl1=sl)
sl.setServiceParent(self.botmaster)
sl.master = self.master
sl.botmaster = self.botmaster
sl_new = FakeBuildSlave2('sl1')
self.new_config.slaves = [ sl_new ]
yield self.botmaster.reconfigServiceSlaves(self.new_config)
# sl *was* replaced (different class)
self.assertIdentical(self.botmaster.slaves['sl1'], sl_new)
@defer.inlineCallbacks
def test_reconfigServiceBuilders_add_remove(self):
bc = config.BuilderConfig(name='bldr', factory=mock.Mock(),
slavename='f')
self.new_config.builders = [ bc ]
yield self.botmaster.reconfigServiceBuilders(self.new_config)
bldr = self.botmaster.builders['bldr']
self.assertIdentical(bldr.parent, self.botmaster)
self.assertIdentical(bldr.master, self.master)
self.assertEqual(self.botmaster.builderNames, [ 'bldr' ])
self.new_config.builders = [ ]
yield self.botmaster.reconfigServiceBuilders(self.new_config)
self.assertIdentical(bldr.parent, None)
self.assertIdentical(bldr.master, None)
self.assertEqual(self.botmaster.builders, {})
self.assertEqual(self.botmaster.builderNames, [])
def test_maybeStartBuildsForBuilder(self):
brd = self.botmaster.brd = mock.Mock()
self.botmaster.maybeStartBuildsForBuilder('frank')
brd.maybeStartBuildsOn.assert_called_once_with(['frank'])
def test_maybeStartBuildsForSlave(self):
brd = self.botmaster.brd = mock.Mock()
b1 = mock.Mock(name='frank')
b1.name = 'frank'
b2 = mock.Mock(name='larry')
b2.name = 'larry'
self.botmaster.getBuildersForSlave = mock.Mock(return_value=[b1, b2])
self.botmaster.maybeStartBuildsForSlave('centos')
self.botmaster.getBuildersForSlave.assert_called_once_with('centos')
brd.maybeStartBuildsOn.assert_called_once_with(['frank', 'larry'])
def test_maybeStartBuildsForAll(self):
brd = self.botmaster.brd = mock.Mock()
self.botmaster.builderNames = ['frank', 'larry']
self.botmaster.maybeStartBuildsForAllBuilders()
brd.maybeStartBuildsOn.assert_called_once_with(['frank', 'larry'])