本文整理汇总了Python中buildbot.test.fake.latent.LatentController.get_started_kind方法的典型用法代码示例。如果您正苦于以下问题:Python LatentController.get_started_kind方法的具体用法?Python LatentController.get_started_kind怎么用?Python LatentController.get_started_kind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildbot.test.fake.latent.LatentController
的用法示例。
在下文中一共展示了LatentController.get_started_kind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_rejects_build_on_instance_with_different_type_timeout_nonzero
# 需要导入模块: from buildbot.test.fake.latent import LatentController [as 别名]
# 或者: from buildbot.test.fake.latent.LatentController import get_started_kind [as 别名]
def test_rejects_build_on_instance_with_different_type_timeout_nonzero(self):
"""
If latent worker supports getting its instance type from properties that
are rendered from build then the buildrequestdistributor must not
schedule any builds on workers that are running different instance type
than what these builds will require.
"""
controller = LatentController(self, 'local',
kind=Interpolate('%(prop:worker_kind)s'),
build_wait_timeout=5)
# a step that we can finish when we want
stepcontroller = BuildStepController()
config_dict = {
'builders': [
BuilderConfig(name="testy",
workernames=["local"],
factory=BuildFactory([stepcontroller.step]),
),
],
'workers': [controller.worker],
'protocols': {'null': {}},
'multiMaster': True,
}
master = self.getMaster(config_dict)
builder_id = self.successResultOf(
master.data.updates.findBuilderId('testy'))
# create build request
self.createBuildrequest(master, [builder_id],
properties=Properties(worker_kind='a'))
# start the build and verify the kind of the worker. Note that the
# buildmaster needs to restart the worker in order to change the worker
# kind, so we allow it both to auto start and stop
self.assertEqual(True, controller.starting)
controller.auto_connect_worker = True
controller.auto_disconnect_worker = True
controller.auto_start(True)
controller.auto_stop(True)
controller.connect_worker()
self.assertEqual('a', (yield controller.get_started_kind()))
# before the other build finished, create another build request
self.createBuildrequest(master, [builder_id],
properties=Properties(worker_kind='b'))
stepcontroller.finish_step(SUCCESS)
# give the botmaster chance to insubstantiate the worker and
# maybe substantiate it for the pending build the builds on worker
self.reactor.advance(0.1)
# verify build has not started, even though the worker is waiting
# for one
self.assertIsNone((yield master.db.builds.getBuild(2)))
self.assertTrue(controller.started)
# wait until the latent worker times out, is insubstantiated,
# is substantiated because of pending buildrequest and starts the build
self.reactor.advance(6)
self.assertIsNotNone((yield master.db.builds.getBuild(2)))
# verify that the second build restarted with the expected instance
# kind
self.assertEqual('b', (yield controller.get_started_kind()))
stepcontroller.finish_step(SUCCESS)
dbdict = yield master.db.builds.getBuild(1)
self.assertEqual(SUCCESS, dbdict['results'])
dbdict = yield master.db.builds.getBuild(2)
self.assertEqual(SUCCESS, dbdict['results'])