Esempio n. 1
0
 def test_mode_full_copy(self):
     self.setupStep(
         darcs.Darcs(repourl='http://localhost/darcs',
                     mode='full',
                     method='copy'))
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['darcs', '--version']) + 0,
         Expect('stat', dict(file='wkdir/.buildbot-patched',
                             logEnviron=True)) + 1,
         Expect('rmdir', dict(dir='wkdir', logEnviron=True, timeout=1200)) +
         0,
         Expect('stat', dict(file='source/_darcs', logEnviron=True)) + 0,
         ExpectShell(workdir='source',
                     command=['darcs', 'pull', '--all', '--verbose']) + 0,
         Expect(
             'cpdir', {
                 'fromdir': 'source',
                 'todir': 'build',
                 'logEnviron': True,
                 'timeout': 1200
             }) + 0,
         ExpectShell(workdir='build',
                     command=['darcs', 'changes', '--max-count=1']) +
         ExpectShell.log(
             'stdio', stdout='Tue Aug 20 09:18:41 IST 2013 [email protected]') +
         0,
     )
     self.expectOutcome(result=SUCCESS)
     self.expectProperty('got_revision',
                         'Tue Aug 20 09:18:41 IST 2013 [email protected]',
                         'Darcs')
     return self.runStep()
Esempio n. 2
0
 def test_mode_full_copy(self):
     self.setup_step(
         darcs.Darcs(repourl='http://localhost/darcs',
                     mode='full', method='copy'))
     self.expect_commands(
         ExpectShell(workdir='wkdir',
                     command=['darcs', '--version'])
         .exit(0),
         ExpectStat(file='wkdir/.buildbot-patched', log_environ=True)
         .exit(1),
         ExpectRmdir(dir='wkdir', log_environ=True, timeout=1200)
         .exit(0),
         ExpectStat(file='source/_darcs', log_environ=True)
         .exit(0),
         ExpectShell(workdir='source',
                     command=['darcs', 'pull', '--all', '--verbose'])
         .exit(0),
         ExpectCpdir(fromdir='source', todir='build', log_environ=True, timeout=1200)
         .exit(0),
         ExpectShell(workdir='build',
                     command=['darcs', 'changes', '--max-count=1'])
         .stdout('Tue Aug 20 09:18:41 IST 2013 [email protected]')
         .exit(0)
     )
     self.expect_outcome(result=SUCCESS)
     self.expect_property(
         'got_revision', 'Tue Aug 20 09:18:41 IST 2013 [email protected]', 'Darcs')
     return self.run_step()
Esempio n. 3
0
 def test_mode_full_clobber(self):
     self.setupStep(
         darcs.Darcs(repourl='http://localhost/darcs',
                     mode='full',
                     method='clobber'))
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['darcs', '--version']) + 0,
         Expect('stat', dict(file='wkdir/.buildbot-patched',
                             logEnviron=True)) + 1,
         Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0,
         ExpectShell(workdir='.',
                     command=[
                         'darcs', 'get', '--verbose', '--lazy',
                         '--repo-name', 'wkdir', 'http://localhost/darcs'
                     ]) + 0,
         ExpectShell(workdir='wkdir',
                     command=['darcs', 'changes', '--max-count=1']) +
         ExpectShell.log(
             'stdio', stdout='Tue Aug 20 09:18:41 IST 2013 [email protected]') +
         0,
     )
     self.expectOutcome(result=SUCCESS)
     self.expectProperty('got_revision',
                         'Tue Aug 20 09:18:41 IST 2013 [email protected]',
                         'Darcs')
     return self.runStep()
Esempio n. 4
0
 def test_mode_full_clobber_revision(self):
     self.setupStep(
         darcs.Darcs(repourl='http://localhost/darcs',
                     mode='full',
                     method='clobber'), dict(revision='abcdef01'))
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['darcs', '--version']) + 0,
         Expect('stat', dict(file='wkdir/.buildbot-patched',
                             logEnviron=True)) + 1,
         Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0,
         Expect(
             'downloadFile',
             dict(blocksize=16384,
                  maxsize=None,
                  reader=ExpectRemoteRef(remotetransfer.StringFileReader),
                  slavedest='.darcs-context',
                  workdir='wkdir',
                  mode=None)) + 0,
         ExpectShell(workdir='.',
                     command=[
                         'darcs', 'get', '--verbose', '--lazy',
                         '--repo-name', 'wkdir', '--context',
                         '.darcs-context', 'http://localhost/darcs'
                     ]) + 0,
         ExpectShell(workdir='wkdir',
                     command=['darcs', 'changes', '--max-count=1']) +
         ExpectShell.log(
             'stdio', stdout='Tue Aug 20 09:18:41 IST 2013 [email protected]') +
         0,
     )
     self.expectOutcome(result=SUCCESS)
     self.expectProperty('got_revision',
                         'Tue Aug 20 09:18:41 IST 2013 [email protected]',
                         'Darcs')
     return self.runStep()
Esempio n. 5
0
 def test_mode_incremental_no_existing_repo(self):
     self.setup_step(
         darcs.Darcs(repourl='http://localhost/darcs',
                     mode='incremental'))
     self.expect_commands(
         ExpectShell(workdir='wkdir',
                     command=['darcs', '--version'])
         .exit(0),
         ExpectStat(file='wkdir/.buildbot-patched', log_environ=True)
         .exit(1),
         ExpectStat(file='wkdir/_darcs', log_environ=True)
         .exit(1),
         ExpectShell(workdir='.',
                     command=['darcs', 'get', '--verbose', '--lazy',
                              '--repo-name', 'wkdir', 'http://localhost/darcs'])
         .exit(0),
         ExpectShell(workdir='wkdir',
                     command=['darcs', 'changes', '--max-count=1'])
         .stdout('Tue Aug 20 09:18:41 IST 2013 [email protected]')
         .exit(0)
     )
     self.expect_outcome(result=SUCCESS)
     self.expect_property(
         'got_revision', 'Tue Aug 20 09:18:41 IST 2013 [email protected]', 'Darcs')
     return self.run_step()
Esempio n. 6
0
 def test_mode_full_clobber_revision_worker_2_16(self):
     self.setup_step(
         darcs.Darcs(repourl='http://localhost/darcs',
                     mode='full', method='clobber'),
         dict(revision='abcdef01'),
         worker_version={'*': '2.16'})
     self.expect_commands(
         ExpectShell(workdir='wkdir',
                     command=['darcs', '--version'])
         .exit(0),
         ExpectStat(file='wkdir/.buildbot-patched', log_environ=True)
         .exit(1),
         ExpectRmdir(dir='wkdir', log_environ=True)
         .exit(0),
         ExpectDownloadFile(blocksize=32768, maxsize=None,
                            reader=ExpectRemoteRef(remotetransfer.StringFileReader),
                            slavedest='.darcs-context', workdir='wkdir', mode=None)
         .exit(0),
         ExpectShell(workdir='.',
                     command=['darcs', 'get', '--verbose', '--lazy',
                              '--repo-name', 'wkdir', '--context',
                              '.darcs-context', 'http://localhost/darcs'])
         .exit(0),
         ExpectShell(workdir='wkdir',
                     command=['darcs', 'changes', '--max-count=1'])
         .stdout('Tue Aug 20 09:18:41 IST 2013 [email protected]')
         .exit(0)
     )
     self.expect_outcome(result=SUCCESS)
     self.expect_property(
         'got_revision', 'Tue Aug 20 09:18:41 IST 2013 [email protected]', 'Darcs')
     return self.run_step()
Esempio n. 7
0
 def test_worker_connection_lost(self):
     self.setupStep(
         darcs.Darcs(repourl='http://localhost/darcs',
                     mode='full',
                     method='clobber'))
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['darcs', '--version']) +
         ('err', error.ConnectionLost()), )
     self.expectOutcome(result=RETRY, state_string="update (retry)")
     return self.runStep()
 def test_slave_connection_lost(self):
     self.setupStep(
         darcs.Darcs(repourl='http://localhost/darcs',
                     mode='full',
                     method='clobber'))
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['darcs', '--version']) +
         ('err', error.ConnectionLost()), )
     self.expectOutcome(
         result=RETRY, status_text=["update", "exception", "slave", "lost"])
     return self.runStep()
 def test_mode_incremental_patch(self):
     self.setupStep(darcs.Darcs(repourl='http://localhost/darcs',
                                mode='incremental'),
                    patch=(1, 'patch'))
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['darcs', '--version']) + 0,
         Expect('stat', dict(file='wkdir/.buildbot-patched',
                             logEnviron=True)) + 1,
         Expect('stat', dict(file='wkdir/_darcs', logEnviron=True)) + 0,
         ExpectShell(workdir='wkdir',
                     command=['darcs', 'pull', '--all', '--verbose']) + 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=[
                         'patch', '-p1', '--remove-empty-files', '--force',
                         '--forward', '-i', '.buildbot-diff'
                     ]) + 0,
         Expect(
             'rmdir',
             dict(dir='wkdir/.buildbot-diff', logEnviron=True,
                  timeout=1200)) + 0,
         ExpectShell(workdir='wkdir',
                     command=['darcs', 'changes', '--max-count=1']) +
         ExpectShell.log(
             'stdio', stdout='Tue Aug 20 09:18:41 IST 2013 [email protected]') +
         0,
     )
     self.expectOutcome(result=SUCCESS, status_text=["update"])
     self.expectProperty('got_revision',
                         'Tue Aug 20 09:18:41 IST 2013 [email protected]',
                         'Darcs')
     return self.runStep()
Esempio n. 10
0
 def test_mode_incremental_patch(self):
     self.setup_step(darcs.Darcs(repourl='http://localhost/darcs',
                                 mode='incremental'),
                     patch=(1, 'patch'))
     self.expect_commands(
         ExpectShell(workdir='wkdir', command=['darcs',
                                               '--version']).exit(0),
         ExpectStat(file='wkdir/.buildbot-patched',
                    log_environ=True).exit(1),
         ExpectStat(file='wkdir/_darcs', log_environ=True).exit(0),
         ExpectShell(workdir='wkdir',
                     command=['darcs', 'pull', '--all',
                              '--verbose']).exit(0),
         ExpectDownloadFile(blocksize=32768,
                            maxsize=None,
                            reader=ExpectRemoteRef(
                                remotetransfer.StringFileReader),
                            workerdest='.buildbot-diff',
                            workdir='wkdir',
                            mode=None).exit(0),
         ExpectDownloadFile(blocksize=32768,
                            maxsize=None,
                            reader=ExpectRemoteRef(
                                remotetransfer.StringFileReader),
                            workerdest='.buildbot-patched',
                            workdir='wkdir',
                            mode=None).exit(0),
         ExpectShell(workdir='wkdir',
                     command=[
                         'patch', '-p1', '--remove-empty-files', '--force',
                         '--forward', '-i', '.buildbot-diff'
                     ]).exit(0),
         ExpectRmdir(dir='wkdir/.buildbot-diff', log_environ=True).exit(0),
         ExpectShell(
             workdir='wkdir',
             command=['darcs', 'changes', '--max-count=1']).stdout(
                 'Tue Aug 20 09:18:41 IST 2013 [email protected]').exit(0))
     self.expect_outcome(result=SUCCESS)
     self.expect_property('got_revision',
                          'Tue Aug 20 09:18:41 IST 2013 [email protected]',
                          'Darcs')
     return self.run_step()
 def test_mode_incremental(self):
     self.setupStep(
         darcs.Darcs(repourl='http://localhost/darcs', mode='incremental'))
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['darcs', '--version']) + 0,
         Expect('stat', dict(file='wkdir/.buildbot-patched',
                             logEnviron=True)) + 1,
         Expect('stat', dict(file='wkdir/_darcs', logEnviron=True)) + 0,
         ExpectShell(workdir='wkdir',
                     command=['darcs', 'pull', '--all', '--verbose']) + 0,
         ExpectShell(workdir='wkdir',
                     command=['darcs', 'changes', '--max-count=1']) +
         ExpectShell.log(
             'stdio', stdout='Tue Aug 20 09:18:41 IST 2013 [email protected]') +
         0,
     )
     self.expectOutcome(result=SUCCESS, status_text=["update"])
     self.expectProperty('got_revision',
                         'Tue Aug 20 09:18:41 IST 2013 [email protected]',
                         'Darcs')
     return self.runStep()
Esempio n. 12
0
 def test_no_repo_url(self):
     self.assertRaises(config.ConfigErrors,
                       lambda: darcs.Darcs(mode='full', method='fresh'))
Esempio n. 13
0
 def test_incremental_invalid_method(self):
     self.assertRaises(
         config.ConfigErrors,
         lambda: darcs.Darcs(repourl='http://localhost/darcs',
                             mode='incremental',
                             method='fresh'))
Esempio n. 14
0
 def test_incorrect_method(self):
     self.assertRaises(
         config.ConfigErrors, lambda: darcs.Darcs(
             repourl='http://localhost/darcs', mode='full', method='fresh'))
Esempio n. 15
0
 def test_no_empty_step_config(self):
     self.assertRaises(config.ConfigErrors, lambda: darcs.Darcs())
Esempio n. 16
0
 def test_no_empty_step_config(self):
     with self.assertRaises(config.ConfigErrors):
         darcs.Darcs()