Пример #1
0
    def setupWorker(self, *args, **kwargs):
        config = KubeHardcodedConfig(master_url="https://kube.example.com")
        self.worker = worker = kubernetes.KubeLatentWorker(
            *args, kube_config=config, **kwargs)
        master = fakemaster.make_master(self, wantData=True)
        self._kube = yield KubeClientService.getFakeService(master, self, kube_config=config)
        worker.setServiceParent(master)
        yield master.startService()
        self.assertTrue(config.running)

        def cleanup():
            self._kube.delete = mock_delete

        self.addCleanup(master.stopService)
        self.addCleanup(cleanup)
        return worker
Пример #2
0
    def setupWorker(self, *args, **kwargs):
        config = KubeHardcodedConfig(master_url="https://kube.example.com")
        self.worker = worker = kubernetes.KubeLatentWorker(
            *args, kube_config=config, **kwargs)
        master = fakemaster.make_master(testcase=self, wantData=True)
        self._kube = self.successResultOf(
            KubeClientService.getFakeService(master, self, kube_config=config))
        worker.setServiceParent(master)
        self.successResultOf(master.startService())
        self.assertTrue(config.running)

        def cleanup():
            self._kube.delete = mock_delete

        self.addCleanup(master.stopService)
        self.addCleanup(cleanup)
        return worker