mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 13:07:56 +00:00
system_test: exercise multiple segments
This commit is contained in:
parent
c3268ca394
commit
2e15c9aed2
@ -116,12 +116,19 @@ class SystemTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_upload_and_download(self):
|
def test_upload_and_download(self):
|
||||||
self.basedir = "test_system/SystemTest/test_upload_and_download"
|
self.basedir = "test_system/SystemTest/test_upload_and_download"
|
||||||
DATA = "Some data to upload\n"
|
# we use 4000 bytes of data, which will result in about 400k written
|
||||||
|
# to disk among all our simulated nodes
|
||||||
|
DATA = "Some data to upload\n" * 200
|
||||||
d = self.set_up_nodes()
|
d = self.set_up_nodes()
|
||||||
def _do_upload(res):
|
def _do_upload(res):
|
||||||
log.msg("UPLOADING")
|
log.msg("UPLOADING")
|
||||||
u = self.clients[0].getServiceNamed("uploader")
|
u = self.clients[0].getServiceNamed("uploader")
|
||||||
d1 = u.upload_data(DATA)
|
# we crank the max segsize down to 1024b for the duration of this
|
||||||
|
# test, so we can exercise multiple segments. It is important
|
||||||
|
# that this is not a multiple of the segment size, so that the
|
||||||
|
# tail segment is not the same length as the others.
|
||||||
|
options = {"max_segment_size": 1024}
|
||||||
|
d1 = u.upload_data(DATA, options)
|
||||||
return d1
|
return d1
|
||||||
d.addCallback(_do_upload)
|
d.addCallback(_do_upload)
|
||||||
def _upload_done(uri):
|
def _upload_done(uri):
|
||||||
|
@ -309,9 +309,9 @@ class Uploader(service.MultiService):
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
# utility functions
|
# utility functions
|
||||||
def upload_data(self, data):
|
def upload_data(self, data, options={}):
|
||||||
return self.upload(Data(data))
|
return self.upload(Data(data), options)
|
||||||
def upload_filename(self, filename):
|
def upload_filename(self, filename, options={}):
|
||||||
return self.upload(FileName(filename))
|
return self.upload(FileName(filename), options)
|
||||||
def upload_filehandle(self, filehandle):
|
def upload_filehandle(self, filehandle, options={}):
|
||||||
return self.upload(FileHandle(filehandle))
|
return self.upload(FileHandle(filehandle), options)
|
||||||
|
Loading…
Reference in New Issue
Block a user