Пример #1
0
    def canBeMergedWith(self, other):
        if self.revision != other.revision:
            return False
        return SourceStamp.canBeMergedWith(self, other)


# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Пример #2
0
    def _connected(self, *args):
        # Our fake source stamp
        # we override canBeMergedWith so that our requests don't get merged together
        ss = SourceStamp()
        ss.canBeMergedWith = lambda x: False

        # Send one request to tie up the slave before sending future requests
        req0 = BuildRequest("reason", ss, "test_builder")
        self.master.botmaster.builders['quick1'].submitBuildRequest(req0)

        # Send 10 requests to alternating builders
        # We fudge the submittedAt field after submitting since they're all
        # getting submitted so close together according to time.time()
        # and all we care about is what order they're run in.
        reqs = []
        self.finish_order = []
        for i in range(10):
            req = BuildRequest(str(i), ss, "test_builder")
            j = i % 2 + 1
            self.master.botmaster.builders['quick%i' % j].submitBuildRequest(req)
            req.submittedAt = i
            # Keep track of what order the builds finished in
            def append(item, arg):
                self.finish_order.append(item)
            req.waitUntilFinished().addCallback(append, req)
            reqs.append(req.waitUntilFinished())

        dl = defer.DeferredList(reqs)
        dl.addCallback(self._all_finished)

        # After our first build finishes, we should wait for the rest to finish
        d = req0.waitUntilFinished()
        d.addCallback(lambda x: dl)
        return d
Пример #3
0
    def canBeMergedWith(self, other):
        if self.revision != other.revision:
            return False
        return SourceStamp.canBeMergedWith(self, other)


# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Пример #4
0
    def testPriority(self):
        self.rmtree("basedir")
        os.mkdir("basedir")
        self.master.loadConfig(config_priority)
        self.master.readConfig = True
        self.master.startService()

        # Our fake source stamp
        # we override canBeMergedWith so that our requests don't get merged together
        ss = SourceStamp()
        ss.canBeMergedWith = lambda x: False

        # Send 10 requests to alternating builders
        # We fudge the submittedAt field after submitting since they're all
        # getting submitted so close together according to time.time()
        # and all we care about is what order they're run in.
        reqs = []
        self.start_order = []
        for i in range(10):
            req = BuildRequest(str(i), ss, "test_builder")
            j = i % 2 + 1
            self.master.botmaster.builders['quick%i' %
                                           j].submitBuildRequest(req)
            req.submittedAt = i

            # Keep track of what order the builds start in
            def append(build):
                self.start_order.append(int(build.reason))

            req.subscribe(append)
            reqs.append(req.waitUntilFinished())

        dl = defer.DeferredList(reqs)
        dl.addCallback(self._all_finished)

        def _delay(res):
            d1 = defer.Deferred()
            reactor.callLater(0.5, d1.callback, None)
            # this test depends upon this 0.5s delay landing us in the middle
            # of one of the builds.
            return d1

        def _connect(res, i):
            return self.connectSlave(slavename="bot%i" % i,
                                     builders=["quick1", "quick2"])

        # Now add the slaves
        d = self.connectSlave(slavename="bot0", builders=["quick1", "quick2"])
        for i in range(1, 5):
            d.addCallback(_delay)
            d.addCallback(_connect, i)

        d.addCallback(lambda x: dl)

        return d
Пример #5
0
    def testPriority(self):
        self.rmtree("basedir")
        os.mkdir("basedir")
        self.master.loadConfig(config_priority)
        self.master.readConfig = True
        self.master.startService()

        # Our fake source stamp
        # we override canBeMergedWith so that our requests don't get merged together
        ss = SourceStamp()
        ss.canBeMergedWith = lambda x: False

        # Send 10 requests to alternating builders
        # We fudge the submittedAt field after submitting since they're all
        # getting submitted so close together according to time.time()
        # and all we care about is what order they're run in.
        reqs = []
        self.start_order = []
        for i in range(10):
            req = BuildRequest(str(i), ss, "test_builder")
            j = i % 2 + 1
            self.master.botmaster.builders['quick%i' % j].submitBuildRequest(req)
            req.submittedAt = i
            # Keep track of what order the builds start in
            def append(build):
                self.start_order.append(int(build.reason))
            req.subscribe(append)
            reqs.append(req.waitUntilFinished())

        dl = defer.DeferredList(reqs)
        dl.addCallback(self._all_finished)

        def _delay(res):
            d1 = defer.Deferred()
            reactor.callLater(0.5, d1.callback, None)
            # this test depends upon this 0.5s delay landing us in the middle
            # of one of the builds.
            return d1

        def _connect(res, i):
            return self.connectSlave(slavename="bot%i" % i, builders=["quick1", "quick2"])

        # Now add the slaves
        d = self.connectSlave(slavename="bot0", builders=["quick1", "quick2"])
        for i in range(1,5):
            d.addCallback(_delay)
            d.addCallback(_connect, i)

        d.addCallback(lambda x: dl)

        return d
Пример #6
0
    def _connected(self, *args):
        # Our fake source stamp
        # we override canBeMergedWith so that our requests don't get merged together
        ss = SourceStamp()
        ss.canBeMergedWith = lambda x: False

        # Send one request to tie up the slave before sending future requests
        req0 = BuildRequest("reason", ss)
        self.master.botmaster.builders['quick1'].submitBuildRequest(req0)

        # Send 10 requests to alternating builders
        # We fudge the submittedAt field after submitting since they're all
        # getting submitted so close together according to time.time()
        # and all we care about is what order they're run in.
        reqs = []
        self.finish_order = []
        for i in range(10):
            req = BuildRequest(str(i), ss)
            j = i % 2 + 1
            self.master.botmaster.builders['quick%i' %
                                           j].submitBuildRequest(req)
            req.submittedAt = i

            # Keep track of what order the builds finished in
            def append(item, arg):
                self.finish_order.append(item)

            req.waitUntilFinished().addCallback(append, req)
            reqs.append(req.waitUntilFinished())

        dl = defer.DeferredList(reqs)
        dl.addCallback(self._all_finished)

        # After our first build finishes, we should wait for the rest to finish
        d = req0.waitUntilFinished()
        d.addCallback(lambda x: dl)
        return d