test_system.mutable: make sure we exercise FEC padding

This commit is contained in:
Brian Warner 2007-11-06 19:50:33 -07:00
parent cc5d35cc07
commit a46e64b0bb

View File

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