コード例 #1
0
ファイル: fakemaster.py プロジェクト: yuben75/buildbot
def make_master(testcase,
                wantMq=False,
                wantDb=False,
                wantData=False,
                wantRealReactor=False,
                url=None,
                **kwargs):
    if wantRealReactor:
        _reactor = reactor
    else:
        assert testcase is not None, "need testcase for fake reactor"
        # The test case must inherit from TestReactorMixin and setup it.
        _reactor = testcase.reactor

    master = FakeMaster(_reactor, **kwargs)
    if url:
        master.buildbotURL = url
    if wantData:
        wantMq = wantDb = True
    if wantMq:
        assert testcase is not None, "need testcase for wantMq"
        master.mq = fakemq.FakeMQConnector(testcase)
        master.mq.setServiceParent(master)
    if wantDb:
        assert testcase is not None, "need testcase for wantDb"
        master.db = fakedb.FakeDBConnector(testcase)
        master.db.setServiceParent(master)
    if wantData:
        master.data = fakedata.FakeDataConnector(master, testcase)
    return master
コード例 #2
0
def make_master(testcase, wantMq=False, wantDb=False, wantData=False,
                wantRealReactor=False, wantGraphql=False, url=None, **kwargs):
    if wantRealReactor:
        _reactor = reactor
    else:
        assert testcase is not None, "need testcase for fake reactor"
        # The test case must inherit from TestReactorMixin and setup it.
        _reactor = testcase.reactor

    master = FakeMaster(_reactor, **kwargs)
    if url:
        master.buildbotURL = url
    if wantData:
        wantMq = wantDb = True
    if wantMq:
        assert testcase is not None, "need testcase for wantMq"
        master.mq = fakemq.FakeMQConnector(testcase)
        master.mq.setServiceParent(master)
    if wantDb:
        assert testcase is not None, "need testcase for wantDb"
        master.db = fakedb.FakeDBConnector(testcase)
        master.db.setServiceParent(master)
    if wantData:
        master.data = fakedata.FakeDataConnector(master, testcase)
    if wantGraphql:
        master.graphql = GraphQLConnector()
        master.graphql.setServiceParent(master)
        master.graphql.data = master.data.realConnector
        master.data._scanModule(endpoint)
        try:
            master.graphql.reconfigServiceWithBuildbotConfig({'www': {'graphql': {'debug': True}}})
        except ImportError:
            pass
    return master
コード例 #3
0
ファイル: test_master.py プロジェクト: pks-os/buildbot
    def setUp(self):
        self.setup_test_reactor()
        self.setUpLogging()
        self.basedir = os.path.abspath('basedir')
        yield self.setUpDirs(self.basedir)

        # don't create child services
        self.patch(master.BuildMaster, 'create_child_services',
                   lambda self: None)

        # patch out a few other annoying things the master likes to do
        self.patch(monkeypatches, 'patch_all', lambda: None)
        self.patch(signal, 'signal', lambda sig, hdlr: None)

        master.BuildMaster.masterHeartbeatService = mock.Mock()
        self.master = master.BuildMaster(self.basedir,
                                         reactor=self.reactor,
                                         config_loader=DefaultLoader())
        self.master.sendBuildbotNetUsageData = mock.Mock()
        self.master.botmaster = FakeBotMaster()
        self.db = self.master.db = fakedb.FakeDBConnector(self)
        yield self.db.setServiceParent(self.master)
        self.mq = self.master.mq = fakemq.FakeMQConnector(self)
        yield self.mq.setServiceParent(self.master)
        self.data = self.master.data = fakedata.FakeDataConnector(
            self.master, self)
        yield self.data.setServiceParent(self.master)
コード例 #4
0
ファイル: test_graphql.py プロジェクト: p12tic/buildbot
    def setUp(self):
        self.setup_test_reactor(use_asyncio=True)

        master = fakemaster.make_master(self)
        master.db = fakedb.FakeDBConnector(self)
        yield master.db.setServiceParent(master)

        master.config.mq = {'type': "simple"}
        master.mq = mqconnector.MQConnector()
        yield master.mq.setServiceParent(master)
        yield master.mq.setup()

        master.data = dataconnector.DataConnector()
        yield master.data.setServiceParent(master)

        master.graphql = GraphQLConnector()
        yield master.graphql.setServiceParent(master)

        master.config.www = {'graphql': {"debug": True}}
        master.graphql.reconfigServiceWithBuildbotConfig(master.config)

        self.master = master
        scheds = [
            ForceScheduler(name="force",
                           builderNames=[
                               "runtests0", "runtests1", "runtests2",
                               "slowruntests"
                           ])
        ]
        self.master.allSchedulers = lambda: scheds

        yield self.master.startService()

        yield self.insert_initial_data()