Exemple #1
0
 def __init__(self, master_id=fakedb.FakeBuildRequestsComponent.MASTER_ID):
     service.MasterService.__init__(self)
     self._master_id = master_id
     self.config = config.MasterConfig()
     self.caches = FakeCaches()
     self.pbmanager = pbmanager.FakePBManager()
     self.basedir = 'basedir'
     self.botmaster = FakeBotMaster(master=self)
     self.botmaster.parent = self
     self.status = FakeStatus()
     self.status.setServiceParent(self)
     self.name = 'fake:/master'
     self.masterid = master_id
     self.buildslaves = bslavemanager.FakeBuildslaveManager(self)
     self.log_rotation = FakeLogRotation()
Exemple #2
0
    def __init__(self,
                 reactor,
                 master_id=fakedb.FakeBuildRequestsComponent.MASTER_ID):
        super().__init__()
        self._master_id = master_id
        self.reactor = reactor
        self.objectids = {}
        self.config = config.MasterConfig()
        self.caches = FakeCaches()
        self.pbmanager = pbmanager.FakePBManager()
        self.initLock = defer.DeferredLock()
        self.basedir = 'basedir'
        self.botmaster = FakeBotMaster()
        self.botmaster.setServiceParent(self)
        self.status = FakeStatus()
        self.status.setServiceParent(self)
        self.name = 'fake:/master'
        self.masterid = master_id
        self.workers = bworkermanager.FakeWorkerManager()
        self.workers.setServiceParent(self)
        self.machine_manager = FakeMachineManager()
        self.machine_manager.setServiceParent(self)
        self.log_rotation = FakeLogRotation()
        self.db = mock.Mock()
        self.next_objectid = 0
        self.config_version = 0

        def getObjectId(sched_name, class_name):
            k = (sched_name, class_name)
            try:
                rv = self.objectids[k]
            except KeyError:
                rv = self.objectids[k] = self.next_objectid
                self.next_objectid += 1
            return defer.succeed(rv)

        self.db.state.getObjectId = getObjectId