def setUp(self): self.master = fakemaster.make_master(testcase=self, wantData=True, wantMq=True, wantDb=True) self.master.db.insertTestData([ fakedb.Builder(id=80, name='test'), ]) self.builder = builder.Builder('test', _addServices=False) self.builder._builderid = 80 self.builder.master = self.master yield self.builder.startService() self.factory = factory.BuildFactory() # will have steps added later new_config = config.MasterConfig() new_config.builders.append( config.BuilderConfig(name='test', slavename='testsl', factory=self.factory)) yield self.builder.reconfigServiceWithBuildbotConfig(new_config) self.slave = BuildSlave('bsl', 'pass') self.slave.sendBuilderList = lambda: defer.succeed(None) self.slave.parent = mock.Mock() self.slave.master.botmaster = mock.Mock() self.slave.botmaster.maybeStartBuildsForSlave = lambda sl: None self.slave.botmaster.getBuildersForSlave = lambda sl: [] self.slave.parent = self.master self.slave.startService() self.conn = fakeprotocol.FakeConnection(self.master, self.slave) yield self.slave.attached(self.conn) sb = self.slavebuilder = slavebuilder.SlaveBuilder() sb.setBuilder(self.builder) yield sb.attached(self.slave, {}) # add the buildset/request self.bsid, brids = yield self.master.db.buildsets.addBuildset( sourcestamps=[{}], reason=u'x', properties={}, builderids=[80], waited_for=False) self.brdict = \ yield self.master.db.buildrequests.getBuildRequest(brids[80]) self.buildrequest = \ yield buildrequest.BuildRequest.fromBrdict(self.master, self.brdict)
def setUp(self): self.master = fakemaster.make_master(testcase=self, wantDb=True) self.builder = builder.Builder('test', _addServices=False) self.builder.master = self.master yield self.builder.startService() self.factory = factory.BuildFactory() # will have steps added later new_config = config.MasterConfig() new_config.builders.append( config.BuilderConfig(name='test', slavename='testsl', factory=self.factory)) yield self.builder.reconfigService(new_config) self.slave = BuildSlave('bsl', 'pass') self.slave.sendBuilderList = lambda: defer.succeed(None) self.slave.botmaster = mock.Mock() self.slave.botmaster.maybeStartBuildsForSlave = lambda sl: None self.slave.master = self.master self.slave.startService() self.remote = FakeBot() yield self.slave.attached(self.remote) sb = self.slavebuilder = slavebuilder.SlaveBuilder() sb.setBuilder(self.builder) yield sb.attached(self.slave, self.remote, {}) # add the buildset/request sssid = yield self.master.db.sourcestampsets.addSourceStampSet() yield self.master.db.sourcestamps.addSourceStamp( branch='br', revision='1', repository='r://', project='', sourcestampsetid=sssid) self.bsid, brids = yield self.master.db.buildsets.addBuildset( sourcestampsetid=sssid, reason=u'x', properties={}, builderNames=['test']) self.brdict = \ yield self.master.db.buildrequests.getBuildRequest(brids['test']) self.buildrequest = \ yield buildrequest.BuildRequest.fromBrdict(self.master, self.brdict)