Changeset 68


Ignore:
Timestamp:
Feb 24, 2010 1:38:44 AM (15 years ago)
Author:
retracile
Message:

Mergebot: add a testcase for dependencies cascading failure one merge conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mergebot/trunk/utils/test.py

    r67 r68  
    295295        self.assertEqual(retval, 0, "svn prposet failed with error %s" % (retval))
    296296
     297    def rm(self, filename):
     298        retval = call(['svn', 'rm', filename],
     299            cwd=self.get_workdir(),
     300            stdout=logfile, stderr=logfile)
     301        self.assertEqual(retval, 0, "svn rm failed with error %s" % (retval))
     302
    297303
    298304class MergeBotTestEnabled(FunctionalTwillTestCaseSetup):
     
    851857        #self._tester.go_to_mergebot()
    852858        tc.find('Waiting')
    853         self._tester.wait_for_empty_queue()
    854        
     859        self._tester.wait_for_empty_queue(60)
     860
     861        self.switch()
     862        self.rm(basename + '-one')
     863        self.rm(basename + '-two')
     864        self.commit('Drop large files so later tests don\'t have to deal with them.')
     865        self.cleanup()
     866
     867
     868class MergeBotTestMergeDependencyCascade(FunctionalSvnTestCaseSetup):
     869    def runTest(self):
     870        """Merge two branches to trunk; make sure the second is cancelled when
     871        the first hits merge conflicts.
     872        """
     873        ticket_one = self._tester.create_ticket(summary=self.__class__.__name__ + " one",
     874            info={'component':'stuff', 'version':'trunk'})
     875        ticket_two = self._tester.create_ticket(summary=self.__class__.__name__ + " two",
     876            info={'component':'stuff', 'version':'trunk'})
     877        basename = self.__class__.__name__
     878
     879        self.checkout()
     880        # create a file on trunk to work with
     881        # make it large enough to give us time to queue the second ticket
     882        # before this one completes its merge
     883        self.add_new_file(basename, 30*1024**2)
     884        self.commit('Add a new file')
     885        # branch the first ticket that we will have fail to merge due to
     886        # conflicts.
     887        self._tester.branch(ticket_one, 'stuff')
     888        # modify the file on trunk
     889        open(os.path.join(self.get_workdir(), basename), 'a').write(random_sentence())
     890        self.commit('Modify the file on trunk')
     891        # and modify the file on the branch
     892        self.switch(ticket_one)
     893        open(os.path.join(self.get_workdir(), basename), 'a').write(random_sentence())
     894        self.commit('Modify the file on branch in conflicting manner')
     895        # create a branch for the second ticket with a non-conflicting change
     896        self._tester.branch(ticket_two, 'stuff')
     897        self.switch(ticket_two)
     898        self.add_new_file(basename + '-two')
     899        self.commit('Add a new file')
     900
     901        # the stage is set.  Now we request the merge that will conflict,
     902        # followed by the merge that won't, and wait for the merges to complete.
     903        self._tester.queue_merge(ticket_one)
     904        self._tester.queue_merge(ticket_two)
     905        self._tester.wait_for_empty_queue(60)
     906        # Then we verify that one had conflicts, and one was cancelled.       
     907        self._tester.go_to_ticket(ticket_one)
     908        tc.find('Found [0-9]+ conflicts? in attempt to merge ')
     909        self._tester.go_to_ticket(ticket_two)
     910        tc.notfind('Merged .* to .* for')
     911        # and clean up the mess
    855912        self.cleanup()
    856913
     
    883940    suite.addTest(MergeBotTestBranchReuse())
    884941    suite.addTest(MergeBotTestMergeDependency())
     942    suite.addTest(MergeBotTestMergeDependencyCascade())
    885943    return suite
    886944
Note: See TracChangeset for help on using the changeset viewer.