diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 0a92d4077..b1fc0be65 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -116,12 +116,19 @@ class SystemTest(unittest.TestCase): def test_upload_and_download(self): 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() def _do_upload(res): log.msg("UPLOADING") 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 d.addCallback(_do_upload) def _upload_done(uri): diff --git a/src/allmydata/upload.py b/src/allmydata/upload.py index 8a65fc439..ca5c72f51 100644 --- a/src/allmydata/upload.py +++ b/src/allmydata/upload.py @@ -309,9 +309,9 @@ class Uploader(service.MultiService): return d # utility functions - def upload_data(self, data): - return self.upload(Data(data)) - def upload_filename(self, filename): - return self.upload(FileName(filename)) - def upload_filehandle(self, filehandle): - return self.upload(FileHandle(filehandle)) + def upload_data(self, data, options={}): + return self.upload(Data(data), options) + def upload_filename(self, filename, options={}): + return self.upload(FileName(filename), options) + def upload_filehandle(self, filehandle, options={}): + return self.upload(FileHandle(filehandle), options)