def testMultipleWorker2_16(self): self.setup_step(transfer.MultipleFileUpload( workersrcs=["srcfile", "srcdir"], masterdest=self.destdir), worker_version={'*': '2.16'}) self.expect_commands( ExpectStat(file="srcfile", workdir='wkdir').stat_file().exit(0), ExpectUploadFile(slavesrc="srcfile", workdir='wkdir', blocksize=16384, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( "Hello world!\n").exit(0), ExpectStat(file="srcdir", workdir='wkdir').stat_dir().exit(0), ExpectUploadDirectory( slavesrc="srcdir", workdir='wkdir', blocksize=16384, compress=None, maxsize=None, writer=ExpectRemoteRef( remotetransfer.DirectoryWriter)).upload_tar_file( 'fake.tar', { "test": "Hello world!" }).exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading 2 files") d = self.run_step() return d
def test_mode_full_clean_patch_worker_2_16(self): self.setup_step( mtn.Monotone(repourl='mtn://localhost/monotone', mode='full', method='clean', branch='master'), patch=(1, 'patch'), worker_version={'*': '2.16'}) self.expect_commands( ExpectShell(workdir='wkdir', command=['mtn', '--version']) .stdout(self.MTN_VER) .exit(0), ExpectStat(file='db.mtn', log_environ=True) .exit(0), ExpectShell(workdir='.', command=['mtn', 'db', 'info', '--db', 'db.mtn']) .stdout('') .exit(0), ExpectShell(workdir='.', command=['mtn', 'pull', 'mtn://localhost/monotone?master', '--db', 'db.mtn', '--ticker=dot']) .exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True) .exit(1), ExpectStat(file='wkdir/_MTN', log_environ=True) .exit(0), ExpectShell(workdir='wkdir', command=['mtn', 'ls', 'unknown']) .stdout('file1\nfile2') .exit(0), ExpectRmdir(dir=['wkdir/file1', 'wkdir/file2'], log_environ=True) .exit(0), ExpectShell(workdir='wkdir', command=['mtn', 'update', '--revision', 'h:master', '--branch', 'master']) .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=['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=['mtn', 'automate', 'select', 'w:']) .stdout(self.REVID) .exit(0) ) self.expect_outcome(result=SUCCESS) self.expect_property('got_revision', self.REVID, 'Monotone') return self.run_step()
def test_mode_full_clean_patch_fail(self): self.setup_step(mercurial.Mercurial(repourl='http://hg.mozilla.org', mode='full', method='clean', branchType='inrepo'), patch=(1, 'patch')) 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), 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=[ 'hg', '--verbose', 'import', '--no-commit', '-p', '1', '-' ], initial_stdin='patch').exit(1)) self.expect_outcome(result=FAILURE, state_string="update (failure)") return self.run_step()
def testURLText(self): self.setup_step( transfer.FileUpload(workersrc=__file__, masterdest=self.destfile, url="http://server/file", urlText="testfile")) self.step.addURL = Mock() self.expect_commands( ExpectUploadFile(workersrc=__file__, workdir='wkdir', blocksize=262144, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( "Hello world!\n").exit(0)) self.expect_outcome( result=SUCCESS, state_string=f"uploading {os.path.basename(__file__)}") yield self.run_step() self.step.addURL.assert_called_once_with("testfile", "http://server/file")
def testBasic(self): self.setup_step(transfer.JSONPropertiesDownload("props.json")) self.step.build.setProperty('key1', 'value1', 'test') read = [] self.expect_commands( ExpectDownloadFile( workerdest="props.json", workdir='wkdir', blocksize=16384, maxsize=None, mode=None, reader=ExpectRemoteRef( remotetransfer.StringFileReader)).download_string( read.append).exit(0)) self.expect_outcome(result=SUCCESS, state_string="downloading to props.json") yield self.run_step() # we decode as key order is dependent of python version self.assertEqual(json.loads((b''.join(read)).decode()), { "properties": { "key1": "value1" }, "sourcestamps": [] })
def test_basic_with_renderable(self): msg = dict(message=Interpolate("Hello World")) self.setup_step(transfer.JSONStringDownload(msg, "hello.json")) self.step.worker = Mock() self.step.remote = Mock() # A place to store what gets read read = [] self.expect_commands( ExpectDownloadFile( workerdest="hello.json", workdir='wkdir', blocksize=16384, maxsize=None, mode=None, reader=ExpectRemoteRef( remotetransfer.StringFileReader)).download_string( read.append).exit(0)) self.expect_outcome(result=SUCCESS, state_string="downloading to hello.json") yield self.run_step() self.assertEqual(b''.join(read), b'{"message": "Hello World"}')
def testBasicWorker2_16(self): self.setup_step(transfer.StringDownload("Hello World", "hello.txt"), worker_version={'*': '2.16'}) self.step.worker = Mock() self.step.remote = Mock() # A place to store what gets read read = [] self.expect_commands( ExpectDownloadFile( slavedest="hello.txt", workdir='wkdir', blocksize=16384, maxsize=None, mode=None, reader=ExpectRemoteRef( remotetransfer.StringFileReader)).download_string( read.append).exit(0)) self.expect_outcome(result=SUCCESS, state_string="downloading to hello.txt") yield self.run_step() self.assertEqual(b''.join(read), b"Hello World")
def testException(self): self.setup_step( transfer.DirectoryUpload(workersrc='srcdir', masterdest=self.destdir)) writers = [] self.expect_commands( ExpectUploadDirectory( workersrc="srcdir", workdir='wkdir', blocksize=16384, compress=None, maxsize=None, writer=ExpectRemoteRef( remotetransfer.DirectoryWriter)).upload_tar_file( 'fake.tar', {"test": "Hello world!"}, error=RuntimeError('uh oh'), out_writers=writers)) self.expect_outcome(result=EXCEPTION, state_string="uploading srcdir (exception)") yield self.run_step() self.assertEqual(len(writers), 1) self.assertEqual(writers[0].cancel.called, True) self.assertEqual(len(self.flushLoggedErrors(RuntimeError)), 1)
def testBasicWorker2_16(self): master_file = __file__ self.setup_step(transfer.FileDownload(mastersrc=master_file, workerdest=self.destfile), worker_version={'*': '2.16'}) # A place to store what gets read read = [] self.expect_commands( ExpectDownloadFile(slavedest=self.destfile, workdir='wkdir', blocksize=16384, maxsize=None, mode=None, reader=ExpectRemoteRef( remotetransfer.FileReader)).download_string( read.append, size=1000).exit(0)) self.expect_outcome( result=SUCCESS, state_string=f"downloading to {os.path.basename(self.destfile)}") yield self.run_step() with open(master_file, "rb") as f: contents = f.read() contents = contents[:1000] self.assertEqual(b''.join(read), contents)
def testException(self): self.setup_step( transfer.MultipleFileUpload(workersrcs=["srcfile", "srcdir"], masterdest=self.destdir)) writers = [] self.expect_commands( ExpectStat(file="srcfile", workdir='wkdir').stat_file().exit(0), ExpectUploadFile(workersrc="srcfile", workdir='wkdir', blocksize=16384, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( "Hello world!\n", out_writers=writers, error=RuntimeError('uh oh'))) self.expect_outcome(result=EXCEPTION, state_string="uploading 2 files (exception)") yield self.run_step() self.assertEqual(len(writers), 1) self.assertEqual(writers[0].cancel.called, True) self.assertEqual(len(self.flushLoggedErrors(RuntimeError)), 1)
def test_url_text(self): self.setup_step( transfer.MultipleFileUpload(workersrcs=["srcfile"], masterdest=self.destdir, url="http://server/dir", urlText='url text')) self.step.addURL = Mock() self.expect_commands( ExpectStat(file='srcfile', workdir='wkdir').stat_file().exit(0), ExpectUploadFile(workersrc='srcfile', workdir='wkdir', blocksize=16384, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( "Hello world!\n").exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading 1 file") yield self.run_step() self.step.addURL.assert_called_once_with("url text", "http://server/dir")
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()
def testTimestamp(self): self.setup_step( transfer.FileUpload(workersrc=__file__, masterdest=self.destfile, keepstamp=True)) timestamp = (os.path.getatime(__file__), os.path.getmtime(__file__)) self.expect_commands( ExpectUploadFile(workersrc=__file__, workdir='wkdir', blocksize=262144, maxsize=None, keepstamp=True, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( 'test\n', timestamp=timestamp).exit(0)) self.expect_outcome( result=SUCCESS, state_string=f"uploading {os.path.basename(__file__)}") yield self.run_step() desttimestamp = (os.path.getatime(self.destfile), os.path.getmtime(self.destfile)) srctimestamp = [int(t) for t in timestamp] desttimestamp = [int(d) for d in desttimestamp] self.assertEqual(srctimestamp[0], desttimestamp[0]) self.assertEqual(srctimestamp[1], desttimestamp[1])
def test_url_text(self): self.setup_step( transfer.DirectoryUpload(workersrc="srcdir", masterdest=self.destdir, url="http://server/dir", urlText='url text')) self.step.addURL = Mock() self.expect_commands( ExpectUploadDirectory( workersrc='srcdir', workdir='wkdir', blocksize=16384, compress=None, maxsize=None, writer=ExpectRemoteRef( remotetransfer.DirectoryWriter)).upload_tar_file( 'fake.tar', { "test": "Hello world!" }).exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading srcdir") yield self.run_step() self.step.addURL.assert_called_once_with("url text", "http://server/dir")
def testSubclass(self): class CustomStep(transfer.MultipleFileUpload): uploadDone = Mock(return_value=None) allUploadsDone = Mock(return_value=None) step = CustomStep(workersrcs=["srcfile", "srcdir"], masterdest=self.destdir) self.setup_step(step) self.expect_commands( ExpectStat(file="srcfile", workdir='wkdir').stat_file().exit(0), ExpectUploadFile(workersrc="srcfile", workdir='wkdir', blocksize=16384, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( "Hello world!\n").exit(0), ExpectStat(file="srcdir", workdir='wkdir').stat_dir().exit(0), ExpectUploadDirectory( workersrc="srcdir", workdir='wkdir', blocksize=16384, compress=None, maxsize=None, writer=ExpectRemoteRef( remotetransfer.DirectoryWriter)).upload_tar_file( 'fake.tar', { "test": "Hello world!" }).exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading 2 files") yield self.run_step() self.assertEqual(step.uploadDone.call_count, 2) self.assertEqual( step.uploadDone.call_args_list[0], ((SUCCESS, 'srcfile', os.path.join(self.destdir, 'srcfile')), {})) self.assertEqual( step.uploadDone.call_args_list[1], ((SUCCESS, 'srcdir', os.path.join(self.destdir, 'srcdir')), {})) self.assertEqual(step.allUploadsDone.call_count, 1) self.assertEqual(step.allUploadsDone.call_args_list[0], ((SUCCESS, ['srcfile', 'srcdir'], self.destdir), {}))
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_full_clean_patch_worker_2_16(self): self.setup_step( bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk', mode='full', method='clean'), patch=(1, 'patch'), worker_version={'*': '2.16'}) self.expect_commands( ExpectShell(workdir='wkdir', command=['bzr', '--version']) .exit(0), ExpectStat(file='wkdir/.buildbot-patched', log_environ=True) .exit(1), ExpectStat(file='wkdir/.bzr', log_environ=True) .exit(0), ExpectShell(workdir='wkdir', command=['bzr', 'clean-tree', '--ignored', '--force']) .exit(0), ExpectShell(workdir='wkdir', command=['bzr', 'update']) .exit(0), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef(remotetransfer.FileReader), slavedest='.buildbot-diff', workdir='wkdir', mode=None) .exit(0), ExpectDownloadFile(blocksize=32768, maxsize=None, reader=ExpectRemoteRef(remotetransfer.FileReader), slavedest='.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=['bzr', 'version-info', '--custom', "--template='{revno}"]) .stdout('100') .exit(0) ) self.expect_outcome(result=SUCCESS) self.expect_property('got_revision', '100', 'Bzr') return self.run_step()
def testBasic(self): self.setup_step( DownloadSecretsToWorker([(os.path.join(self.temp_path, "pathA"), "something"), (os.path.join(self.temp_path, "pathB"), "something more")])) self.expect_commands( ExpectDownloadFile(maxsize=None, mode=stat.S_IRUSR | stat.S_IWUSR, reader=ExpectRemoteRef(remotetransfer.StringFileReader), blocksize=32 * 1024, workerdest=os.path.join(self.temp_path, "pathA"), workdir="wkdir") .exit(0), ExpectDownloadFile(maxsize=None, mode=stat.S_IRUSR | stat.S_IWUSR, reader=ExpectRemoteRef(remotetransfer.StringFileReader), blocksize=32 * 1024, workerdest=os.path.join(self.temp_path, "pathB"), workdir="wkdir") .exit(0), ) self.expect_outcome( result=SUCCESS, state_string="finished") d = self.run_step() return d
def testFailure(self): self.setup_step(transfer.StringDownload("Hello World", "hello.txt")) self.expect_commands( ExpectDownloadFile(workerdest="hello.txt", workdir='wkdir', blocksize=16384, maxsize=None, mode=None, reader=ExpectRemoteRef( remotetransfer.StringFileReader)).exit(1)) self.expect_outcome(result=FAILURE, state_string="downloading to hello.txt (failure)") return self.run_step()
def testBasic(self): self.setup_step( transfer.FileUpload(workersrc='srcfile', masterdest=self.destfile)) self.expect_commands( ExpectUploadFile(workersrc="srcfile", workdir='wkdir', blocksize=262144, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( "Hello world!\n").exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading srcfile") d = self.run_step() return d
def testMultipleString(self): self.setup_step( transfer.MultipleFileUpload(workersrcs="srcfile", masterdest=self.destdir)) self.expect_commands( ExpectStat(file="srcfile", workdir='wkdir').stat_file().exit(0), ExpectUploadFile(workersrc="srcfile", workdir='wkdir', blocksize=16384, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( "Hello world!\n").exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading 1 file") d = self.run_step() return d
def testFailure(self): self.setup_step( transfer.DirectoryUpload(workersrc="srcdir", masterdest=self.destdir)) self.expect_commands( ExpectUploadDirectory(workersrc="srcdir", workdir='wkdir', blocksize=16384, compress=None, maxsize=None, writer=ExpectRemoteRef( remotetransfer.DirectoryWriter)).exit(1)) self.expect_outcome(result=FAILURE, state_string="uploading srcdir (failure)") yield self.run_step()
def testFailure(self): self.setup_step( transfer.FileUpload(workersrc='srcfile', masterdest=self.destfile)) self.expect_commands( ExpectUploadFile(workersrc="srcfile", workdir='wkdir', blocksize=262144, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).exit(1)) self.expect_outcome(result=FAILURE, state_string="uploading srcfile (failure)") d = self.run_step() return d
def test_downloadFileContentToWorker(self): @defer.inlineCallbacks def testFunc(x): res = yield x.downloadFileContentToWorker("/path/dest1", "file text") self.assertEqual(res, None) self.setup_step(CompositeUser(testFunc)) self.expect_commands( ExpectDownloadFile(maxsize=None, workdir='wkdir', mode=None, reader=ExpectRemoteRef( remotetransfer.FileReader), blocksize=32768, workerdest='/path/dest1')) self.expect_outcome(result=SUCCESS) return self.run_step()
def test_getFileContentFromWorker2_16(self): @defer.inlineCallbacks def testFunc(x): res = yield x.getFileContentFromWorker("file.txt") self.assertEqual(res, "Hello world!") self.setup_step(CompositeUser(testFunc), worker_version={'*': '2.16'}) self.expect_commands( ExpectUploadFile( slavesrc="file.txt", workdir='wkdir', blocksize=32 * 1024, maxsize=None, writer=ExpectRemoteRef( remotetransfer.StringFileWriter)).upload_string( "Hello world!").exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def do_test_suppressions(self, step, supps_file='', stdout='', exp_warning_count=0, exp_warning_log='', exp_exception=False, props=None): self.setup_step(step) if props is not None: for key in props: self.build.setProperty(key, props[key], "") if supps_file is not None: self.expect_commands( # step will first get the remote suppressions file ExpectUploadFile(blocksize=32768, maxsize=None, workersrc='supps', workdir='wkdir', writer=ExpectRemoteRef( remotetransfer.StringFileWriter) ).upload_string(supps_file).exit(0), # and then run the command ExpectShell(workdir='wkdir', command=["make"]).stdout(stdout).exit(0)) else: self.expect_commands( ExpectShell(workdir='wkdir', command=["make"]).stdout(stdout).exit(0)) if exp_exception: self.expect_outcome(result=EXCEPTION, state_string="'make' (exception)") else: if exp_warning_count != 0: self.expect_outcome(result=WARNINGS, state_string="'make' (warnings)") self.expect_log_file(f"warnings ({exp_warning_count})", exp_warning_log) else: self.expect_outcome(result=SUCCESS, state_string="'make'") self.expect_property("warnings-count", exp_warning_count) return self.run_step()
def test_interrupt(self): self.setup_step( transfer.FileUpload(workersrc='srcfile', masterdest=self.destfile)) self.expect_commands( ExpectUploadFile(workersrc='srcfile', workdir='wkdir', blocksize=262144, maxsize=None, keepstamp=False, writer=ExpectRemoteRef(remotetransfer.FileWriter), interrupted=True).exit(0)) self.interrupt_nth_remote_command(0) self.expect_outcome(result=CANCELLED, state_string="uploading srcfile (cancelled)") self.expect_log_file('interrupt', 'interrupt reason') yield self.run_step()
def testFailure(self): self.setup_step( transfer.MultipleFileUpload(workersrcs=["srcfile", "srcdir"], masterdest=self.destdir)) self.expect_commands( ExpectStat(file="srcfile", workdir='wkdir').stat_file().exit(0), ExpectUploadFile(workersrc="srcfile", workdir='wkdir', blocksize=16384, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).exit(1)) self.expect_outcome(result=FAILURE, state_string="uploading 2 files (failure)") d = self.run_step() return d
def testGlob(self): self.setup_step( transfer.MultipleFileUpload(workersrcs=["src*"], masterdest=self.destdir, glob=True)) self.expect_commands( ExpectGlob(path=os.path.join('wkdir', 'src*'), log_environ=False).files(["srcfile"]).exit(0), ExpectStat(file="srcfile", workdir='wkdir').stat_file().exit(0), ExpectUploadFile(workersrc="srcfile", workdir='wkdir', blocksize=16384, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( "Hello world!\n").exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading 1 file") d = self.run_step() return d
def testWorker2_16(self): self.setup_step(transfer.DirectoryUpload(workersrc="srcdir", masterdest=self.destdir), worker_version={'*': '2.16'}) self.expect_commands( ExpectUploadDirectory( slavesrc="srcdir", workdir='wkdir', blocksize=16384, compress=None, maxsize=None, writer=ExpectRemoteRef( remotetransfer.DirectoryWriter)).upload_tar_file( 'fake.tar', { "test": "Hello world!" }).exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading srcdir") d = self.run_step() return d