]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blobdiff - src/allmydata/test/test_mutable.py
test_mutable.Update: increase timeout from 120s to 400s, slaves are failing
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / test / test_mutable.py
index 1b7fc9fb2f3caa0ebcba998996c8882c1bfa7f02..deb4a58ceb0873e2a0d9cf21203facdc90e0f460 100644 (file)
@@ -7,7 +7,7 @@ from twisted.internet.interfaces import IConsumer
 from zope.interface import implements
 from allmydata import uri, client
 from allmydata.nodemaker import NodeMaker
-from allmydata.util import base32, consumer, fileutil
+from allmydata.util import base32, consumer, fileutil, mathutil
 from allmydata.util.hashutil import tagged_hash, ssk_writekey_hash, \
      ssk_pubkey_fingerprint_hash
 from allmydata.util.deferredutil import gatherResults
@@ -256,7 +256,6 @@ class Filenode(unittest.TestCase, testutil.ShouldFailMixin):
             self.failUnlessEqual(len(shnums), 1)
         d.addCallback(_created)
         return d
-    test_create.timeout = 15
 
 
     def test_create_mdmf(self):
@@ -560,7 +559,6 @@ class Filenode(unittest.TestCase, testutil.ShouldFailMixin):
         d.addCallback(lambda ignored:
             self.failUnlessEqual(self.c.data, "contents1" * 100000))
         return d
-    test_retrieve_pause.timeout = 25
 
 
     def test_download_from_mdmf_cap(self):
@@ -640,7 +638,6 @@ class Filenode(unittest.TestCase, testutil.ShouldFailMixin):
             return d
         d.addCallback(_created)
         return d
-    test_create_with_initial_contents.timeout = 15
 
 
     def test_create_mdmf_with_initial_contents(self):
@@ -663,7 +660,6 @@ class Filenode(unittest.TestCase, testutil.ShouldFailMixin):
             return d
         d.addCallback(_created)
         return d
-    test_create_mdmf_with_initial_contents.timeout = 20
 
 
     def test_response_cache_memory_leak(self):
@@ -822,7 +818,6 @@ class Filenode(unittest.TestCase, testutil.ShouldFailMixin):
             return d
         d.addCallback(_created)
         return d
-    test_modify.timeout = 15
 
 
     def test_modify_backoffer(self):
@@ -1398,7 +1393,6 @@ class Roundtrip(unittest.TestCase, testutil.ShouldFailMixin, PublishMixin):
             self.failIf(servermap.all_peers())
         d.addCallback(_check_servermap)
         return d
-    test_no_servers.timeout = 15
 
     def test_no_servers_download(self):
         sb2 = make_storagebroker(num_peers=0)
@@ -1419,7 +1413,6 @@ class Roundtrip(unittest.TestCase, testutil.ShouldFailMixin, PublishMixin):
         d.addCallback(_restore)
         d.addCallback(_retrieved)
         return d
-    test_no_servers_download.timeout = 15
 
 
     def _test_corrupt_all(self, offset, substring,
@@ -1802,7 +1795,6 @@ class Checker(unittest.TestCase, CheckerMixin, PublishMixin):
         d = self._fn.check(Monitor(), verify=True)
         d.addCallback(self.check_good, "test_verify_good")
         return d
-    test_verify_good.timeout = 15
 
     def test_verify_all_bad_sig(self):
         d = corrupt(None, self._storage, 1) # bad sig
@@ -2585,7 +2577,6 @@ class Problems(GridTestMixin, unittest.TestCase, testutil.ShouldFailMixin):
             return d
         d.addCallback(_created)
         return d
-    test_unexpected_shares.timeout = 15
 
     def test_bad_server(self):
         # Break one server, then create the file: the initial publish should
@@ -2701,7 +2692,6 @@ class Problems(GridTestMixin, unittest.TestCase, testutil.ShouldFailMixin):
                             "Ran out of non-bad servers",
                             nm.create_mutable_file, MutableData("contents"))
         return d
-    test_publish_no_servers.timeout = 30
 
 
     def test_privkey_query_error(self):
@@ -3222,6 +3212,28 @@ class Version(GridTestMixin, unittest.TestCase, testutil.ShouldFailMixin, \
         d.addCallback(_read_data)
         return d
 
+    def test_partial_read_starting_on_segment_boundary(self):
+        d = self.mdmf_node.get_best_readable_version()
+        c = consumer.MemoryConsumer()
+        offset = mathutil.next_multiple(128 * 1024, 3)
+        d.addCallback(lambda version:
+            version.read(c, offset, 50))
+        expected = self.data[offset:offset+50]
+        d.addCallback(lambda ignored:
+            self.failUnlessEqual(expected, "".join(c.chunks)))
+        return d
+
+    def test_partial_read_ending_on_segment_boundary(self):
+        d = self.mdmf_node.get_best_readable_version()
+        c = consumer.MemoryConsumer()
+        offset = mathutil.next_multiple(128 * 1024, 3)
+        start = offset - 50
+        d.addCallback(lambda version:
+            version.read(c, start, 51))
+        expected = self.data[offset-50:offset+1]
+        d.addCallback(lambda ignored:
+            self.failUnlessEqual(expected, "".join(c.chunks)))
+        return d
 
     def test_read(self):
         d = self.mdmf_node.get_best_readable_version()
@@ -3248,6 +3260,8 @@ class Version(GridTestMixin, unittest.TestCase, testutil.ShouldFailMixin, \
 
 
 class Update(GridTestMixin, unittest.TestCase, testutil.ShouldFailMixin):
+    timeout = 400 # these tests are too big, 120s is not enough on slow
+                  # platforms
     def setUp(self):
         GridTestMixin.setUp(self)
         self.basedir = self.mktemp()
@@ -3465,7 +3479,6 @@ class Update(GridTestMixin, unittest.TestCase, testutil.ShouldFailMixin):
             d.addCallback(lambda results:
                 self.failUnlessEqual(results, new_data))
         return d
-    test_append_power_of_two.timeout = 15
 
 
     def test_update_sdmf(self):