]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
system_test: exercise multiple segments
authorBrian Warner <warner@allmydata.com>
Tue, 17 Apr 2007 20:40:47 +0000 (13:40 -0700)
committerBrian Warner <warner@allmydata.com>
Tue, 17 Apr 2007 20:40:47 +0000 (13:40 -0700)
src/allmydata/test/test_system.py
src/allmydata/upload.py

index 0a92d4077fda93eadbf970f613257b4b1aa6587a..b1fc0be65d7e097b2bf486fb795523336427a7ba 100644 (file)
@@ -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):
index 8a65fc439c5d2571705c1d6b1f997cdb95642ddf..ca5c72f51959d70de8dfe42715581b92f52178d5 100644 (file)
@@ -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)