]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test_system.mutable: make sure we exercise FEC padding
authorBrian Warner <warner@allmydata.com>
Wed, 7 Nov 2007 02:50:33 +0000 (19:50 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 7 Nov 2007 02:50:33 +0000 (19:50 -0700)
src/allmydata/test/test_system.py

index c0628cc75d53089dafc1b2dc0f36e2786c4002a4..a58b1389d2d924a323e0cbe0dcb6402d9acbf40c 100644 (file)
@@ -249,7 +249,7 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase):
             #print "CREATING MUTABLE FILENODE"
             c = self.clients[0]
             n = MutableFileNode(c)
-            d1 = n.create("initial contents go here")
+            d1 = n.create("initial contents go here.") # 25 bytes % 3 != 0
             def _done(res):
                 log.msg("DONE: %s" % (res,))
                 #print "DONE", res
@@ -286,24 +286,32 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase):
                                stdout=out, stderr=err)
             output = out.getvalue()
             self.failUnlessEqual(rc, 0)
-            self.failUnless("Mutable slot found:\n" in output)
-            self.failUnless("share_type: SDMF\n" in output)
-            peerid = idlib.nodeid_b2a(self.clients[client_num].nodeid)
-            self.failUnless(" WE for nodeid: %s\n" % peerid in output)
-            self.failUnless(" num_extra_leases: 0\n" in output)
-            self.failUnless(" container_size: 381\n" in output)
-            self.failUnless(" data_length: 381\n" in output)
-            self.failUnless("  secrets are for nodeid: %s\n" % peerid in output)
-            self.failUnless(" SDMF contents:\n" in output)
-            self.failUnless("  seqnum: 1\n" in output)
-            self.failUnless("  required_shares: 3\n" in output)
-            self.failUnless("  total_shares: 10\n" in output)
-            self.failUnless("  segsize: 24\n" in output)
-            self.failUnless("  datalen: 24\n" in output)
-            # the exact share_hash_chain nodes depends upon the sharenum, and
-            # is more of a hassle to compute than I want to deal with now
-            self.failUnless("  share_hash_chain: " in output)
-            self.failUnless("  block_hash_tree: 1 nodes\n" in output)
+            try:
+                self.failUnless("Mutable slot found:\n" in output)
+                self.failUnless("share_type: SDMF\n" in output)
+                peerid = idlib.nodeid_b2a(self.clients[client_num].nodeid)
+                self.failUnless(" WE for nodeid: %s\n" % peerid in output)
+                self.failUnless(" num_extra_leases: 0\n" in output)
+                self.failUnless(" container_size: 382\n" in output)
+                self.failUnless(" data_length: 382\n" in output)
+                self.failUnless("  secrets are for nodeid: %s\n" % peerid
+                                in output)
+                self.failUnless(" SDMF contents:\n" in output)
+                self.failUnless("  seqnum: 1\n" in output)
+                self.failUnless("  required_shares: 3\n" in output)
+                self.failUnless("  total_shares: 10\n" in output)
+                self.failUnless("  segsize: 27\n" in output)
+                self.failUnless("  datalen: 25\n" in output)
+                # the exact share_hash_chain nodes depends upon the sharenum,
+                # and is more of a hassle to compute than I want to deal with
+                # now
+                self.failUnless("  share_hash_chain: " in output)
+                self.failUnless("  block_hash_tree: 1 nodes\n" in output)
+            except unittest.FailTest:
+                print
+                print "dump-share output was:"
+                print output
+                raise
         d.addCallback(_test_debug)
 
         return d