本文整理匯總了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'])