Exemplo n.º 1
0
 def test_d_ini(self):
     self.setupSimple()
     c = Change('author', ['test-app/locales/l10n.ini'],
                'comment',
                branch='test-branch')
     c.number = 1
     self.scheduler.addChange(c)
     c = Change('author', ['test-app/locales/en-US/app.dtd'],
                'comment',
                branch='test-branch')
     c.number = 2
     self.scheduler.addChange(c)
     self.failUnlessEqual(len(self.master.sets), 1)
     bset = self.master.sets[0]
     self.failUnlessEqual(bset.builderNames, ['tree-builds'])
     ftb = FakeBuilder('tree-builds')
     bset.start([ftb])
     self.failUnlessEqual(len(ftb.requests), 1)
     st = bset.status
     self.failIf(st.isFinished())
     builder = builderstatus.BuilderStatus('tree-builds')
     build = builderstatus.BuildStatus(builder, 1)
     build.setResults(builderstatus.SUCCESS)
     ftb.requests[0].finished(build)
     self.failUnless(st.isFinished())
     self.failUnless(self.scheduler.dSubmitBuildsets)
     self.scheduler.dSubmitBuildsets.cancel()
     pendings = self.scheduler.pendings
     self.failUnlessEqual(len(pendings), 2)
     self.failUnlessEqual(len(pendings[('test', 'de')]), 1)
     self.failUnlessEqual(len(pendings[('test', 'fr')]), 1)
Exemplo n.º 2
0
    def testAnyBranch2(self):
        # like testAnyBranch but without fileIsImportant
        self.basedir = 'scheduler/Scheduling/AnyBranch2'
        self.create_master()
        s = scheduler.AnyBranchScheduler("b1", 2, ["a", "b"])

        d = self.setSchedulers(s)

        def _addChange(ign, c):
            self.master.change_svc.addChange(c)

        c1 = Change("alice", ["important", "not important"],
                    "some changes",
                    branch="branch1")
        d.addCallback(_addChange, c1)
        c2 = Change("bob", ["not important", "boring"],
                    "some more changes",
                    branch="branch1")
        d.addCallback(_addChange, c2)
        c3 = Change("carol", ["important", "dull"],
                    "even more changes",
                    branch="branch1")
        d.addCallback(_addChange, c3)

        c4 = Change("carol", ["important"], "other branch", branch="branch2")
        d.addCallback(_addChange, c4)

        d.addCallback(lambda ign: self.master.scheduler_manager.when_quiet())
        d.addCallback(self._testAnyBranch2_1)
        return d
Exemplo n.º 3
0
    def _testCheck3(self, res):
        self.assertEquals(len(self.changes), 3)
        self.assertEquals(self.t.last_change, 3)
        self.assert_(not self.t.working)

        # They're supposed to go oldest to newest, so this one must be first.
        self.assertEquals(
            self.changes[0].asText(),
            Change(who='slamb',
                   files=['whatbranch'],
                   comments=change_2_log,
                   revision='2',
                   when=self.makeTime("2006/04/13 21:46:23"),
                   branch='trunk').asText())

        # These two can happen in either order, since they're from the same
        # Perforce change.
        self.failUnlessIn(
            Change(who='bob',
                   files=['branch_b_file', 'whatbranch'],
                   comments=change_3_log,
                   revision='3',
                   when=self.makeTime("2006/04/13 21:51:39"),
                   branch='branch_b').asText(),
            [c.asText() for c in self.changes])
        self.failUnlessIn(
            Change(who='bob',
                   files=['whatbranch'],
                   comments=change_3_log,
                   revision='3',
                   when=self.makeTime("2006/04/13 21:51:39"),
                   branch='branch_c').asText(),
            [c.asText() for c in self.changes])
Exemplo n.º 4
0
    def testAnyBranch(self):
        s = scheduler.AnyBranchScheduler("b1",
                                         None,
                                         1, ["a", "b"],
                                         fileIsImportant=self.isImportant)
        self.addScheduler(s)

        c1 = Change("alice", ["important", "not important"],
                    "some changes",
                    branch="branch1")
        s.addChange(c1)
        c2 = Change("bob", ["not important", "boring"],
                    "some more changes",
                    branch="branch1")
        s.addChange(c2)
        c3 = Change("carol", ["important", "dull"],
                    "even more changes",
                    branch="branch1")
        s.addChange(c3)

        c4 = Change("carol", ["important"], "other branch", branch="branch2")
        s.addChange(c4)

        c5 = Change("carol", ["important"], "default branch", branch=None)
        s.addChange(c5)

        d = defer.Deferred()
        reactor.callLater(2, d.callback, None)
        d.addCallback(self._testAnyBranch_1)
        return d
Exemplo n.º 5
0
    def testBranch(self):
        s = scheduler.Scheduler("b1",
                                "branch1",
                                2, ["a", "b"],
                                fileIsImportant=self.isImportant)
        self.addScheduler(s)

        c0 = Change("carol", ["important"], "other branch", branch="other")
        s.addChange(c0)
        self.failIf(s.timer)
        self.failIf(s.importantChanges)

        c1 = Change("alice", ["important", "not important"],
                    "some changes",
                    branch="branch1")
        s.addChange(c1)
        c2 = Change("bob", ["not important", "boring"],
                    "some more changes",
                    branch="branch1")
        s.addChange(c2)
        c3 = Change("carol", ["important", "dull"],
                    "even more changes",
                    branch="branch1")
        s.addChange(c3)

        self.failUnlessEqual(s.importantChanges, [c1, c3])
        self.failUnlessEqual(s.allChanges, [c1, c2, c3])
        self.failUnless(s.timer)

        d = defer.Deferred()
        reactor.callLater(4, d.callback, None)
        d.addCallback(self._testBranch_1)
        return d
    def test_lastChange(self):
        # First, we need to add a few changes!
        c1 = Change(who='me!',
                    branch='b1',
                    revision='1',
                    files=[],
                    comments='really important',
                    revlink='from poller')
        c2 = Change(who='me!',
                    branch='b2',
                    revision='2',
                    files=[],
                    comments='really important',
                    revlink='from poller')
        c3 = Change(who='me!',
                    branch='b1',
                    revision='3',
                    files=[],
                    comments='really important',
                    revlink='from poller')
        for c in [c1, c2, c3]:
            self.dbc.addChangeToDatabase(c)

        c = self.dbc.runInteractionNow(lambda t: lastChange(self.dbc, t, 'b1'))
        self.assertEquals(c.revision, c3.revision)

        c = self.dbc.runInteractionNow(lambda t: lastChange(self.dbc, t, 'b2'))
        self.assertEquals(c.revision, c2.revision)
    def test_notification_started(self):
        irc = MyContact()

        my_builder = MyBuilder("builder78")
        my_build = MyIrcBuild(my_builder, 23, builder.SUCCESS)
        my_build.changes = (
            Change(who='author1',
                   files=['file1'],
                   comments='comment1',
                   revision=123),
            Change(who='author2',
                   files=['file2'],
                   comments='comment2',
                   revision=456),
        )

        irc.command_NOTIFY("on started", "mynick")

        irc.message = ""
        irc.buildStarted(my_builder.getName(), my_build)
        self.failUnlessEqual(
            irc.message, "build #23 of builder78 started including [123, 456]",
            "Start notification generated with notify_events=['started']")

        irc.message = ""
        irc.buildFinished(my_builder.getName(), my_build, None)
        self.failUnlessEqual(
            irc.message, "",
            "No finished notification with notify_events=['started']")
Exemplo n.º 8
0
    def testAddChange(self):
        self.basedir = "changemaster/manager/addchange"
        self.create_master()

        m = self.master.change_svc

        change = Change('user', [], 'comments', revision="123")
        m.addChange(change)
        d = self.stall(None, 0.5)

        def _check(ign):
            events = list(m.eventGenerator())
            self.failUnlessEqual(len(events), 1)
            self.failUnlessEqual(events[0].who, "user")
            self.failUnlessEqual(events[0].files, [])
            self.failUnlessEqual(events[0].number, 1)
            c1 = m.getChangeNumberedNow(1)
            self.failUnlessIdentical(c1, events[0])  # should be cached
            r = m.getChangesGreaterThan(0)
            self.failUnlessEqual(r, [c1])
            self.c1 = c1

        d.addCallback(_check)
        d.addCallback(lambda ign: m.getChangeByNumber(1))
        d.addCallback(lambda r: self.failUnlessEqual(r, self.c1))
        d.addCallback(lambda ign: m.getChangesByNumber([1]))
        d.addCallback(lambda r: self.failUnlessEqual(r, [self.c1]))

        change2 = Change('otheruser', ["foo.c"], "comments2", revision="124")
        d.addCallback(lambda ign: m.addChange(change2))
        d.addCallback(self.stall, 0.5)

        def _then(ign):
            events = list(m.eventGenerator())
            self.failUnlessEqual(len(events), 2)
            self.failUnlessEqual(events[0].who, "otheruser")
            self.failUnlessEqual(events[0].files, ["foo.c"])
            self.failUnlessEqual(events[0].number, 2)
            self.failUnlessEqual(events[1], self.c1)
            c1a = m.getChangeNumberedNow(1)
            self.failUnlessIdentical(c1a, self.c1)
            c2 = m.getChangeNumberedNow(2)
            self.failUnlessIdentical(c2, events[0])
            r = m.getChangesGreaterThan(0)
            self.failUnlessEqual(r, [self.c1, c2])

            d = m.getChangeByNumber(2)
            d.addCallback(lambda r: self.failUnlessEqual(r, c2))
            d.addCallback(lambda ign: m.getChangesByNumber([2, 1]))
            d.addCallback(lambda r: self.failUnlessEqual(r, [c2, self.c1]))
            return d

        d.addCallback(_then)
        return d
Exemplo n.º 9
0
 def testAsDictChanges(self):
     changes = [
         Change('nobody', [], 'Comment', branch='br2', revision='rev2'),
         Change('nob', ['file2', 'file3'],
                'Com',
                branch='br3',
                revision='rev3'),
     ]
     s = SourceStamp(branch='Br',
                     revision='Rev',
                     patch=(1, 'Pat'),
                     changes=changes)
     r = s.asDict()
     del r['changes'][0]['when']
     del r['changes'][1]['when']
     EXPECTED = {
         'revision':
         'rev3',
         'branch':
         'br3',
         'hasPatch':
         True,
         'project':
         '',
         'repository':
         '',
         'changes': [{
             'branch': 'br2',
             'category': None,
             'comments': 'Comment',
             'files': [],
             'number': None,
             'properties': [],
             'revision': 'rev2',
             'revlink': '',
             'project': '',
             'repository': '',
             'who': 'nobody'
         }, {
             'branch': 'br3',
             'category': None,
             'comments': 'Com',
             'files': ['file2', 'file3'],
             'number': None,
             'properties': [],
             'revision': 'rev3',
             'revlink': '',
             'who': 'nob',
             'project': '',
             'repository': '',
         }],
     }
     self.assertEqual(EXPECTED, r)
Exemplo n.º 10
0
    def testImportantChanges(self):
        self.basedir = 'scheduler/Scheduling/ImportantChanges'
        self.create_master()
        s = scheduler.Scheduler("b1",
                                branch="branch1",
                                treeStableTimer=2,
                                builderNames=["a", "b"],
                                fileIsImportant=self.isImportant)

        # Hijack run to prevent changes from being processed
        oldrun = s.run
        s.run = lambda: None

        d = self.setSchedulers(s)

        def _addChange(ign, c):
            self.master.change_svc.addChange(c)
            self.master.scheduler_manager.trigger()
            return self.master.db.runInteraction(s.classify_changes)

        c1 = Change("alice", ["important", "not important"],
                    "some changes",
                    branch="branch1")
        d.addCallback(_addChange, c1)
        c2 = Change("bob", ["not important", "boring"],
                    "some more changes",
                    branch="branch1")
        d.addCallback(_addChange, c2)
        c3 = Change("carol", ["important", "dull"],
                    "even more changes",
                    branch="branch1")
        d.addCallback(_addChange, c3)

        def _check(ign):
            important, unimportant = self.master.db.runInteractionNow(
                lambda t: self.master.db.scheduler_get_classified_changes(
                    s.schedulerid, t))
            important = [c.number for c in important]
            unimportant = [c.number for c in unimportant]
            self.failUnlessEqual(important, [c1.number, c3.number])
            self.failUnlessEqual(unimportant, [c2.number])
            s.run = oldrun
            d1 = s.run()
            d1.addCallback(lambda ign: self.master.scheduler_manager.trigger())
            d1.addCallback(
                lambda ign: self.master.scheduler_manager.when_quiet())
            return d1

        d.addCallback(_check)
        d.addCallback(self._testBranch_1)
        return d
Exemplo n.º 11
0
 def notify(self, root, files, message, user):
     pathnames = []
     isdir = 0
     for f in files:
         if not isinstance(
                 f,
             (cvstoys.common.VersionedPatch, cvstoys.common.Directory)):
             continue
         pathname, filename = f.pathname, f.filename
         #r1, r2 = getattr(f, 'r1', None), getattr(f, 'r2', None)
         if isinstance(f, cvstoys.common.Directory):
             isdir = 1
         path = os.path.join(pathname, filename)
         log.msg("FreshCVS notify '%s'" % path)
         if self.prefix:
             if path.startswith(self.prefix):
                 path = path[len(self.prefix):]
             else:
                 continue
         pathnames.append(path)
     if pathnames:
         # now() is close enough: FreshCVS *is* realtime, after all
         when = util.now()
         c = Change(user, pathnames, message, isdir, when=when)
         self.parent.addChange(c)
    def test_lastRevFunc(self):
        createTestData(self.dbc)
        self.s.builderNames = ['builder1']

        # Check that ssFunc returns something for both branches
        ssFunc = lastRevFunc('b1')
        ss = self.dbc.runInteractionNow(lambda t: ssFunc(self.s, t))
        self.assertEquals(ss.revision, 'r1')

        ssFunc = lastRevFunc('b2')
        ss = self.dbc.runInteractionNow(lambda t: ssFunc(self.s, t))
        self.assertEquals(ss.revision, 'r234567890')

        # Check that ssFunc returns None if triggerBuildIfNoChanges=False
        # and we already built the revision
        ssFunc = lastRevFunc('b1', triggerBuildIfNoChanges=False)
        ss = self.dbc.runInteractionNow(lambda t: ssFunc(self.s, t))
        self.assertEquals(ss, None)

        # Check that ssFunc returns the later revision if we already built
        # something old
        c1 = Change(who='me!',
                    branch='b1',
                    revision='r345',
                    files=[],
                    comments='really important',
                    when=2,
                    revlink='from poller')
        self.dbc.addChangeToDatabase(c1)
        ssFunc = lastRevFunc('b1', triggerBuildIfNoChanges=False)
        ss = self.dbc.runInteractionNow(lambda t: ssFunc(self.s, t))
        self.assertEquals(ss.revision, 'r345')
Exemplo n.º 13
0
    def create_changes(self, new_logentries):
        changes = []

        for el in new_logentries:
            branch_files = [] # get oldest change first
            revision = str(el.getAttribute("revision"))
            dbgMsg("Adding change revision %s" % (revision,))
            # TODO: the rest of buildbot may not be ready for unicode 'who'
            # values
            author   = self._get_text(el, "author")
            comments = self._get_text(el, "msg")
            # there is a "date" field, but it provides localtime in the
            # repository's timezone, whereas we care about buildmaster's
            # localtime (since this will get used to position the boxes on
            # the Waterfall display, etc). So ignore the date field and use
            # our local clock instead.
            #when     = self._get_text(el, "date")
            #when     = time.mktime(time.strptime("%.19s" % when,
            #                                     "%Y-%m-%dT%H:%M:%S"))
            branches = {}
            pathlist = el.getElementsByTagName("paths")[0]
            for p in pathlist.getElementsByTagName("path"):
                action = p.getAttribute("action")
                path = "".join([t.data for t in p.childNodes])
                # the rest of buildbot is certaily not yet ready to handle
                # unicode filenames, because they get put in RemoteCommands
                # which get sent via PB to the buildslave, and PB doesn't
                # handle unicode.
                path = path.encode("ascii")
                if path.startswith("/"):
                    path = path[1:]
                where = self._transform_path(path)

                # if 'where' is None, the file was outside any project that
                # we care about and we should ignore it
                if where:
                    branch, filename = where
                    if not branch in branches:
                        branches[branch] = { 'files': []}
                    branches[branch]['files'].append(filename)

                    if not branches[branch].has_key('action'):
                        branches[branch]['action'] = action

            for branch in branches.keys():
                action = branches[branch]['action']
                files  = branches[branch]['files']
                number_of_files_changed = len(files)

                if action == u'D' and number_of_files_changed == 1 and files[0] == '':
                    log.msg("Ignoring deletion of branch '%s'" % branch)
                else:
                    c = Change(who=author,
                               files=files,
                               comments=comments,
                               revision=revision,
                               branch=branch)
                    changes.append(c)

        return changes
Exemplo n.º 14
0
    def test_create_scheduler_changes(self):
        s = timed.Nightly(name="tsched",
                          builderNames=['tbuild'],
                          onlyIfChanged=True)
        s.parent = DummyParent(self.dbc)

        d = self.dbc.addSchedulers([s])

        # Add some changes
        for i in range(10):
            c = Change(who='just a guy', files=[], comments="")
            d.addCallback(lambda res: self.dbc.addChangeToDatabase(c))

        def runScheduler(res):
            return s.run()

        d.addCallback(runScheduler)

        def checkTables(res):
            # Check that we have the number of changes we think we should have
            self.assertEquals(len(self.dbc.changes), 10)

            # Check that there are entries in scheduler_changes
            important, unimportant = self.dbc.classified_changes.get(
                s.schedulerid, ([], []))
            self.assertEquals(len(important + unimportant), 10)

        d.addCallback(checkTables)
        return d
Exemplo n.º 15
0
 def testAB(self):
     self.setupSimple()
     c = Change('author', ['some/file.dtd'],
                'comment',
                branch='dir',
                properties={'locale': 'ab'})
     c.number = 1
     self.scheduler.addChange(c)
     self.failUnlessEqual(len(self.master.sets), 1)
     bset = self.master.sets[0]
     props = bset.getProperties()
     self.assertEqual(props['locale'], 'ab')
     self.assertEqual(props['branch'], 'dir')
     self.assertEqual(props['tree'], 'dir-compare')
     self.failUnlessEqual(bset.builderNames, ['dir-compare'])
     ftb = FakeBuilder('dir-compare')
     bset.start([ftb])
     self.failUnlessEqual(len(ftb.requests), 1)
     st = bset.status
     self.failIf(st.isFinished())
     builder = builderstatus.BuilderStatus('dir-compare')
     build = builderstatus.BuildStatus(builder, 1)
     build.setResults(builderstatus.SUCCESS)
     ftb.requests[0].finished(build)
     self.failUnless(st.isFinished())
Exemplo n.º 16
0
    def testUTF16Change(self):
        # Create changes.pck
        cm = OldChangeMaster()
        cm.changes = [
            Change(who=u"Frosty the \N{SNOWMAN}".encode("utf16"),
                   files=["foo"],
                   comments=u"Frosty the \N{SNOWMAN}".encode("utf16"),
                   branch="b1",
                   revision=12345)
        ]

        # instead of running contrib/fix_changes_pickle_encoding.py, we just call
        # the changemanager's recode_changes directly - it's the function at the
        # heart of the script anyway.
        cm.recode_changes('utf16', quiet=True)

        # and dump the recoded changemanager to changes.pck before trying a schema upgrade
        cPickle.dump(cm, open(os.path.join(self.basedir, "changes.pck"), "w"))

        sm = manager.DBSchemaManager(self.spec, self.basedir)
        sm.upgrade(quiet=True)

        c = self.db.getChangeNumberedNow(1)

        self.assertEquals(c.who, u"Frosty the \N{SNOWMAN}")
        self.assertEquals(c.comments, u"Frosty the \N{SNOWMAN}")
Exemplo n.º 17
0
    def testOffBranch(self):
        self.basedir = 'scheduler/Scheduling/OffBranch'
        self.create_master()
        s = scheduler.Scheduler("b1",
                                branch="branch1",
                                treeStableTimer=2,
                                builderNames=["a", "b"],
                                fileIsImportant=self.isImportant)
        d = self.setSchedulers(s)

        def _addChange(ign, c):
            self.master.change_svc.addChange(c)
            return self.master.scheduler_manager.when_quiet()

        c0 = Change("carol", ["important"], "other branch", branch="other")
        d.addCallback(_addChange, c0)

        def _check(ign):
            important, unimportant = self.master.db.runInteractionNow(
                lambda t: self.master.db.scheduler_get_classified_changes(
                    s.schedulerid, t))
            self.failIf(important)
            self.failIf(unimportant)

        d.addCallback(_check)
Exemplo n.º 18
0
    def _getChangeByNumber_query_done(self, res, changeid):
        (rows, link_rows, file_rows, properties) = res
        if not rows:
            return None
        (who, comments, isdir, branch, revision, revlink, when, category,
         repository, project) = rows[0]
        branch = str_or_none(branch)
        revision = str_or_none(revision)
        links = [row[0] for row in link_rows]
        links.sort()
        files = [row[0] for row in file_rows]
        files.sort()

        c = Change(who=who,
                   files=files,
                   comments=comments,
                   isdir=isdir,
                   links=links,
                   revision=revision,
                   when=when,
                   branch=branch,
                   category=category,
                   revlink=revlink,
                   repository=repository,
                   project=project)
        c.properties.updateFromProperties(properties)
        c.number = changeid
        self._change_cache.add(changeid, c)
        return c
Exemplo n.º 19
0
 def test_repo_downloads_from_change_source(self):
     """basic repo download from change source, and check that repo_downloaded is updated"""
     self.mySetupStep(repoDownloads=repo.RepoDownloadsFromChangeSource())
     change = Change(None, None, None, properties={
         'event.change.owner.email': '*****@*****.**',
         'event.change.subject': 'fix 1234',
         'event.change.project': 'pr',
         'event.change.owner.name': 'Dustin',
         'event.change.number': '4321',
         'event.change.url': 'http://buildbot.net',
         'event.change.branch': 'br',
         'event.type': 'patchset-created',
         'event.patchSet.revision': 'abcdef',
         'event.patchSet.number': '12',
         'event.source': 'GerritChangeSource'
     })
     self.build.allChanges = lambda x=None: [change]
     self.expectnoClobber()
     self.expectRepoSync()
     self.expectCommands(
         self.ExpectShell(command=['repo', 'download', 'pr', '4321/12'])
         + 0
         + Expect.log(
             'stdio', stderr="test/bla refs/changes/64/564/12 -> FETCH_HEAD\n")
         + Expect.log('stdio', stderr="HEAD is now at 0123456789abcdef...\n"))
     self.expectProperty(
         "repo_downloaded", "564/12 0123456789abcdef ", "Source")
     return self.myRunStep()
 def addChange(files=None, comments=None, author=None, revision=None,
               when_timestamp=None, branch=None, repository='', codebase='',
               category='', project='', src=None):
     self.changes_added.append(Change(revision=revision, files=files,
                          who=author, branch=branch, comments=comments,
                          when=datetime2epoch(when_timestamp), repository=repository, codebase=codebase))
     return defer.succeed(None)
Exemplo n.º 21
0
 def test_repo_downloads_from_change_source_codebase(self):
     """basic repo download from change source, and check that repo_downloaded is updated"""
     self.mySetupStep(
         repoDownloads=repo.RepoDownloadsFromChangeSource("mycodebase"))
     change = Change(None,
                     None,
                     None,
                     properties={
                         'event.change.owner.email': '*****@*****.**',
                         'event.change.subject': 'fix 1234',
                         'event.change.project': 'pr',
                         'event.change.owner.name': 'Dustin',
                         'event.change.number': '4321',
                         'event.change.url': 'http://buildbot.net',
                         'event.change.branch': 'br',
                         'event.type': 'patchset-created',
                         'event.patchSet.revision': 'abcdef',
                         'event.patchSet.number': '12',
                         'event.source': 'GerritChangeSource'
                     })
     # getSourceStamp is faked by SourceStepMixin
     ss = self.build.getSourceStamp("")
     ss.changes = [change]
     self.expectnoClobber()
     self.expectRepoSync()
     self.expect_commands(
         self.ExpectShell(
             command=['repo', 'download', 'pr', '4321/12']).exit(0).stderr(
                 "test/bla refs/changes/64/564/12 -> FETCH_HEAD\n").stderr(
                     "HEAD is now at 0123456789abcdef...\n"))
     self.expect_property("repo_downloaded", "564/12 0123456789abcdef ",
                          "Source")
     return self.myRunStep()
Exemplo n.º 22
0
 def testChange(self):
     s = self.status
     c = Change("user", ["foo.c"], "comments")
     self.master.change_svc.addChange(c)
     # TODO: something more like s.getChanges(), requires IChange and
     # an accessor in IStatus. The HTML page exists already, though
     self.assertURLEqual(c, "changes/1")
    def testPropsScheduler(self):
        S = makePropertiesScheduler(
            Scheduler, propfuncs=[buildIDSchedFunc, buildUIDSchedFunc])
        s = S(name="s", builderNames=["b1"])
        s.parent = mock.Mock()
        s.parent.db = self.dbc

        c1 = Change(who='me!',
                    branch='b1',
                    revision='1',
                    files=[],
                    comments='really important')
        self.dbc.addChangeToDatabase(c1)
        s.parent.change_svc.getChangesGreaterThan.return_value = [c1]

        d = self.dbc.addSchedulers([s])

        d.addCallback(lambda ign: s.run())

        def check(ign):
            requests = self.dbc.runQueryNow("select * from buildrequests")
            self.assertEquals(len(requests), 1)
            props = self.dbc.runQueryNow("select * from buildset_properties")
            self.assertEquals(len(props), 3)
            # Make sure we haven't modifed the scheduler's internal set of
            # properties
            self.assertEquals(s.properties.asList(),
                              [("scheduler", "s", "Scheduler")])

        d.addCallback(check)
        return d
 def getExpectedChangesHg(self, repository, bookmark=True):
     return self.getExpectedChanges(repository, bookmark) + [
             # backwards compatibility
             Change(revision=u'68475k937dj69dk20567845jh9456726153hv47g7', files=None,
                    who=u'dev5 <*****@*****.**>', branch=u'1.0/devOld', comments=u'list of changes5',
                    when=1421667231, category=None, project='',
                    repository=repository, codebase=''),
             ]
 def getExpectedChanges(self, repository, bookmark=True):
     return [Change(revision=u'5553a6194a6393dfbec82f96654d52a76ddf844d', files=None,
                    who=u'dev3 <*****@*****.**>', branch=u'1.0/dev', comments=u'list of changes3',
                    when=1421583649, category=None, project='',
                    repository=repository, codebase=''),
             Change(revision=u'b2e48cbab3f0753f99db833acff6ca18096854bd', files=None,
                    who=u'dev2 <*****@*****.**>', branch=u'1.0/dev', comments=u'list of changes2',
                    when=1421667112, category=None, project='',
                    repository=repository, codebase=''),
             Change(revision=u'117b9a27b5bf65d7e7b5edb48f7fd59dc4170486', files=None,
                    who=u'dev1 <*****@*****.**>', branch=u'1.0/dev', comments=u'list of changes1',
                    when=1421667230, repository=repository, codebase=''),
             Change(revision=u'70fc4de2ff3828a587d80f7528c1b5314c51550e7', files=None,
                    who=u'dev4 <*****@*****.**>', branch=u'trunkbookmark' if bookmark else u'trunk',
                    comments=u'list of changes4', when=1422983233,
                    category=None, project='', repository=repository,
                    codebase='')
             ]
Exemplo n.º 26
0
    def testNoRevision(self):
        c = Change(who="catlee",
                   files=["foo"],
                   comments="",
                   branch="b1",
                   revision=None)
        ss = SourceStamp(changes=[c])

        self.assertEquals(ss.revision, None)
Exemplo n.º 27
0
 def testDE(self):
     self.setupSimple()
     c = Change('author', ['some/file.dtd'],
                'comment',
                branch='dir',
                properties={'locale': 'de'})
     c.number = 1
     self.scheduler.addChange(c)
     self.failUnlessEqual(len(self.master.sets), 0)
Exemplo n.º 28
0
 def test_c_mixed(self):
     self.setupSimple()
     c = Change('author', ['test-app/locales/en-US/file.dtd'],
                'comment',
                branch='test-branch')
     c.number = 1
     self.scheduler.addChange(c)
     c = Change('author', ['test-app/file.dtd'],
                'comment',
                branch='l10n-test',
                properties={'locale': 'de'})
     c.number = 2
     self.scheduler.addChange(c)
     self.failUnless(self.scheduler.dSubmitBuildsets)
     self.scheduler.dSubmitBuildsets.cancel()
     pendings = self.scheduler.pendings
     self.failUnlessEqual(len(pendings), 2)
     self.failUnlessEqual(len(pendings[('test', 'de')]), 2)
     self.failUnlessEqual(len(pendings[('test', 'fr')]), 1)
Exemplo n.º 29
0
        def _then(ign):
            # add an extra status target to make pay attention to which builds
            # start and which don't.
            self.logger = Logger(self.master)

            # kick off upstream1, which has a failing Builder and thus will
            # not trigger downstream3. We hit upstream1 (and not upstream3)
            # by using a Change with some files.
            c = Change("warner", ["foo.py"], "comments")
            self.master.change_svc.addChange(c)
    def test_lastChange_ignores_changes_with_no_revlink(self):
        c1 = Change(who='me!',
                    branch='b1',
                    revision='1',
                    files=[],
                    comments='really important')
        self.dbc.addChangeToDatabase(c1)

        c = self.dbc.runInteractionNow(lambda t: lastChange(self.dbc, t, 'b1'))
        self.assertEquals(c, None)