示例#1
0
 def test_no_repourl(self):
     self.assertRaises(config.ConfigErrors,
                       lambda: mercurial.Mercurial(mode="full"))
示例#2
0
 def test_incorrect_method(self):
     self.assertRaises(
         config.ConfigErrors,
         lambda: mercurial.Mercurial(repourl='http://hg.mozilla.org',
                                     method='invalid'))
示例#3
0
 def test_mode_full_clean_env(self):
     self.setup_step(
         mercurial.Mercurial(repourl='http://hg.mozilla.org',
                             mode='full',
                             method='clean',
                             branchType='inrepo',
                             env={'abc': '123'}))
     self.expect_commands(
         ExpectShell(workdir='wkdir',
                     command=['hg', '--verbose', '--version'],
                     env={
                         'abc': '123'
                     }).exit(0),
         ExpectStat(file='wkdir/.buildbot-patched',
                    log_environ=True).exit(1),
         ExpectStat(file='wkdir/.hg', log_environ=True).exit(0),
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', '--config', 'extensions.purge=',
                         'purge'
                     ],
                     env={
                         'abc': '123'
                     }).exit(0),
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', 'pull', 'http://hg.mozilla.org',
                         '--rev', 'default'
                     ],
                     env={
                         'abc': '123'
                     }).exit(0),
         ExpectShell(workdir='wkdir',
                     command=['hg', '--verbose', 'identify', '--branch'],
                     env={
                         'abc': '123'
                     }).stdout('default').exit(0),
         ExpectShell(workdir='wkdir',
                     command=['hg', '--verbose', 'locate', 'set:added()'],
                     env={
                         'abc': '123'
                     }).exit(1),
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', 'update', '--clean', '--rev',
                         'default'
                     ],
                     env={
                         'abc': '123'
                     }).exit(0),
         ExpectShell(
             workdir='wkdir',
             command=[
                 'hg', '--verbose', 'parents', '--template', '{node}\\n'
             ],
             env={
                 'abc': '123'
             }).stdout('\n').stdout(
                 'f6ad368298bd941e934a41f3babc827b2aa95a1d').exit(0))
     self.expect_outcome(result=SUCCESS)
     return self.run_step()
示例#4
0
 def test_mode_full_clean_patch(self):
     self.setupStep(mercurial.Mercurial(repourl='http://hg.mozilla.org',
                                        mode='full',
                                        method='clean',
                                        branchType='inrepo'),
                    patch=(1, 'patch'))
     self.expectCommands(
         ExpectShell(workdir='wkdir',
                     command=['hg', '--verbose', '--version']) + 0,
         Expect('stat', dict(file='wkdir/.buildbot-patched',
                             logEnviron=True)) + 0,
         Expect('stat', dict(file='wkdir/.hg', logEnviron=True)) + 0,
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', '--config', 'extensions.purge=',
                         'purge'
                     ]) + 0,
         ExpectShell(
             workdir='wkdir',
             command=['hg', '--verbose', 'pull', 'http://hg.mozilla.org']) +
         0,
         ExpectShell(workdir='wkdir',
                     command=['hg', '--verbose', 'identify', '--branch']) +
         ExpectShell.log('stdio', stdout='default') + 0,
         ExpectShell(workdir='wkdir',
                     command=['hg', '--verbose', 'locate', 'set:added()']) +
         1,
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', 'update', '--clean', '--rev',
                         'default'
                     ]) + 0,
         Expect(
             'downloadFile',
             dict(blocksize=16384,
                  maxsize=None,
                  reader=ExpectRemoteRef(_FileReader),
                  slavedest='.buildbot-diff',
                  workdir='wkdir',
                  mode=None)) + 0,
         Expect(
             'downloadFile',
             dict(blocksize=16384,
                  maxsize=None,
                  reader=ExpectRemoteRef(_FileReader),
                  slavedest='.buildbot-patched',
                  workdir='wkdir',
                  mode=None)) + 0,
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', 'import', '--no-commit', '-p',
                         '1', '-'
                     ],
                     initialStdin='patch') + 0,
         Expect('rmdir', dict(dir='wkdir/.buildbot-diff',
                              logEnviron=True)) + 0,
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', 'parents', '--template',
                         '{node}\\n'
                     ]) + ExpectShell.log('stdio', stdout='\n') +
         ExpectShell.log(
             'stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') +
         0,
     )
     self.expectOutcome(result=SUCCESS, status_text=["update"])
     return self.runStep()
示例#5
0
 def test_incorrect_branchType(self):
     with self.assertRaises(config.ConfigErrors):
         mercurial.Mercurial(repourl='http://hg.mozilla.org',
                             branchType='invalid')
示例#6
0
 def test_no_repourl(self):
     with self.assertRaises(config.ConfigErrors):
         mercurial.Mercurial(mode="full")
示例#7
0
 def test_mode_full_clean_patch_worker_2_16(self):
     self.setup_step(mercurial.Mercurial(repourl='http://hg.mozilla.org',
                                         mode='full',
                                         method='clean',
                                         branchType='inrepo'),
                     patch=(1, 'patch'),
                     worker_version={'*': '2.16'})
     self.expect_commands(
         ExpectShell(workdir='wkdir',
                     command=['hg', '--verbose', '--version']).exit(0),
         ExpectStat(file='wkdir/.buildbot-patched',
                    log_environ=True).exit(0),
         ExpectStat(file='wkdir/.hg', log_environ=True).exit(0),
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', '--config', 'extensions.purge=',
                         'purge'
                     ]).exit(0),
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', 'pull', 'http://hg.mozilla.org',
                         '--rev', 'default'
                     ]).exit(0),
         ExpectShell(workdir='wkdir',
                     command=['hg', '--verbose', 'identify',
                              '--branch']).stdout('default').exit(0),
         ExpectShell(workdir='wkdir',
                     command=['hg', '--verbose', 'locate',
                              'set:added()']).exit(1),
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', 'update', '--clean', '--rev',
                         'default'
                     ]).exit(0),
         ExpectDownloadFile(blocksize=32768,
                            maxsize=None,
                            reader=ExpectRemoteRef(
                                remotetransfer.StringFileReader),
                            slavedest='.buildbot-diff',
                            workdir='wkdir',
                            mode=None).exit(0),
         ExpectDownloadFile(blocksize=32768,
                            maxsize=None,
                            reader=ExpectRemoteRef(
                                remotetransfer.StringFileReader),
                            slavedest='.buildbot-patched',
                            workdir='wkdir',
                            mode=None).exit(0),
         ExpectShell(workdir='wkdir',
                     command=[
                         'hg', '--verbose', 'import', '--no-commit', '-p',
                         '1', '-'
                     ],
                     initial_stdin='patch').exit(0),
         ExpectRmdir(dir='wkdir/.buildbot-diff', log_environ=True).exit(0),
         ExpectShell(
             workdir='wkdir',
             command=[
                 'hg', '--verbose', 'parents', '--template', '{node}\\n'
             ]).stdout('\n').stdout(
                 'f6ad368298bd941e934a41f3babc827b2aa95a1d').exit(0))
     self.expect_outcome(result=SUCCESS)
     return self.run_step()
示例#8
0
 def test_neither_repourl_nor_baseURL(self):
     self.assertRaises(ValueError, lambda: mercurial.Mercurial(mode="full"))
示例#9
0
 def test_repourl_and_baseURL(self):
     self.assertRaises(
         ValueError,
         lambda: mercurial.Mercurial(repourl='http://hg.mozilla.org',
                                     baseURL="http://hg.mozilla.org"))