当前位置: 首页>>代码示例>>Python>>正文


Python LatentController.auto_start方法代码示例

本文整理汇总了Python中buildbot.test.fake.latent.LatentController.auto_start方法的典型用法代码示例。如果您正苦于以下问题:Python LatentController.auto_start方法的具体用法?Python LatentController.auto_start怎么用?Python LatentController.auto_start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在buildbot.test.fake.latent.LatentController的用法示例。


在下文中一共展示了LatentController.auto_start方法的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 auto_start [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'])
开发者ID:,项目名称:,代码行数:75,代码来源:


注:本文中的buildbot.test.fake.latent.LatentController.auto_start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。