Sun Feb 21 22:27:33 MST 2010 zooko@zooko.com * dirnode: add tests of literal dirnodes (the current code already passes these tests) New patches: [dirnode: add tests of literal dirnodes (the current code already passes these tests) zooko@zooko.com**20100222052733 Ignore-this: 1fd7fa613c6f3e83dbbc6df03144bb4c ] { hunk ./src/allmydata/test/test_dirnode.py 6 from zope.interface import implements from twisted.trial import unittest from twisted.internet import defer +from twisted.internet.interfaces import IConsumer from allmydata import uri, dirnode from allmydata.client import Client from allmydata.immutable import upload hunk ./src/allmydata/test/test_dirnode.py 27 from base64 import b32decode import common_util as testutil +class MemAccum: + implements(IConsumer) + def registerProducer(self, producer, streaming): + self.producer = producer + self.producer.resumeProducing() + pass + def unregisterProducer(self): + pass + def write(self, data): + assert not hasattr(self, 'data') + self.data = data + self.producer.resumeProducing() + +setup_py_uri = "URI:CHK:n7r3m6wmomelk4sep3kw5cvduq:os7ijw5c3maek7pg65e5254k2fzjflavtpejjyhshpsxuqzhcwwq:3:20:14861" +one_uri = "URI:LIT:n5xgk" # LIT for "one" +mut_write_uri = "URI:SSK:vfvcbdfbszyrsaxchgevhmmlii:euw4iw7bbnkrrwpzuburbhppuxhc3gwxv26f6imekhz7zyw2ojnq" +empty_litdir_uri = "URI:DIR2-LIT:" +tiny_litdir_uri = "URI:DIR2-LIT:gqytunj2onug64tufqzdcosvkjetutcjkq5gw4tvm5vwszdgnz5hgyzufqydulbshj5x2lbm" # contains one child which is itself also LIT +mut_read_uri = "URI:SSK-RO:jf6wkflosyvntwxqcdo7a54jvm:euw4iw7bbnkrrwpzuburbhppuxhc3gwxv26f6imekhz7zyw2ojnq" +future_write_uri = "x-tahoe-crazy://I_am_from_the_future." +future_read_uri = "x-tahoe-crazy-readonly://I_am_from_the_future." + class Dirnode(GridTestMixin, unittest.TestCase, testutil.ShouldFailMixin, testutil.StallMixin, ErrorMixin): timeout = 240 # It takes longer than 120 seconds on Francois's arm box. hunk ./src/allmydata/test/test_dirnode.py 76 c = self.g.clients[0] nm = c.nodemaker - setup_py_uri = "URI:CHK:n7r3m6wmomelk4sep3kw5cvduq:os7ijw5c3maek7pg65e5254k2fzjflavtpejjyhshpsxuqzhcwwq:3:20:14861" - one_uri = "URI:LIT:n5xgk" # LIT for "one" - mut_write_uri = "URI:SSK:vfvcbdfbszyrsaxchgevhmmlii:euw4iw7bbnkrrwpzuburbhppuxhc3gwxv26f6imekhz7zyw2ojnq" - mut_read_uri = "URI:SSK-RO:jf6wkflosyvntwxqcdo7a54jvm:euw4iw7bbnkrrwpzuburbhppuxhc3gwxv26f6imekhz7zyw2ojnq" - future_write_uri = "x-tahoe-crazy://I_am_from_the_future." - future_read_uri = "x-tahoe-crazy-readonly://I_am_from_the_future." kids = {u"one": (nm.create_from_cap(one_uri), {}), u"two": (nm.create_from_cap(setup_py_uri), {"metakey": "metavalue"}), hunk ./src/allmydata/test/test_dirnode.py 82 u"mut": (nm.create_from_cap(mut_write_uri, mut_read_uri), {}), u"fut": (nm.create_from_cap(future_write_uri, future_read_uri), {}), u"fro": (nm.create_from_cap(None, future_read_uri), {}), + u"empty_litdir": (nm.create_from_cap(empty_litdir_uri), {}), + u"tiny_litdir": (nm.create_from_cap(tiny_litdir_uri), {}), } d = c.create_dirnode(kids) hunk ./src/allmydata/test/test_dirnode.py 101 def _check_kids(children): self.failUnlessEqual(sorted(children.keys()), - [u"fro", u"fut", u"mut", u"one", u"two"]) + [u"empty_litdir", u"fro", u"fut", u"mut", u"one", u"tiny_litdir", u"two"]) one_node, one_metadata = children[u"one"] two_node, two_metadata = children[u"two"] mut_node, mut_metadata = children[u"mut"] hunk ./src/allmydata/test/test_dirnode.py 107 fut_node, fut_metadata = children[u"fut"] fro_node, fro_metadata = children[u"fro"] + emptylit_node, emptylit_metadata = children[u"empty_litdir"] + tinylit_node, tinylit_metadata = children[u"tiny_litdir"] self.failUnlessEqual(one_node.get_size(), 3) self.failUnlessEqual(one_node.get_uri(), one_uri) hunk ./src/allmydata/test/test_dirnode.py 133 self.failUnlessEqual(fro_node.get_uri(), "ro." + future_read_uri) self.failUnlessEqual(fut_node.get_readonly_uri(), "ro." + future_read_uri) self.failUnless(isinstance(fro_metadata, dict), fro_metadata) + + self.failIf(emptylit_node.is_unknown()) + self.failIf(tinylit_node.is_unknown()) + + d2 = defer.succeed(None) + d2.addCallback(lambda ignored: emptylit_node.list()) + d2.addCallback(lambda children: self.failUnlessEqual(children, {})) + d2.addCallback(lambda ignored: tinylit_node.list()) + d2.addCallback(lambda children: self.failUnlessEqual(set(children.keys()), set(['short']))) + d2.addCallback(lambda ignored: tinylit_node.list()) + d2.addCallback(lambda children: children['short'][0].read(MemAccum())) + d2.addCallback(lambda accum: self.failUnlessEqual(accum.data, "The end.")) + return d2 + d.addCallback(_check_kids) d.addCallback(lambda ign: nm.create_new_mutable_directory(kids)) hunk ./src/allmydata/test/test_dirnode.py 176 c = self.g.clients[0] nm = c.nodemaker - setup_py_uri = "URI:CHK:n7r3m6wmomelk4sep3kw5cvduq:os7ijw5c3maek7pg65e5254k2fzjflavtpejjyhshpsxuqzhcwwq:3:20:14861" - one_uri = "URI:LIT:n5xgk" # LIT for "one" - mut_write_uri = "URI:SSK:vfvcbdfbszyrsaxchgevhmmlii:euw4iw7bbnkrrwpzuburbhppuxhc3gwxv26f6imekhz7zyw2ojnq" - mut_read_uri = "URI:SSK-RO:e3mdrzfwhoq42hy5ubcz6rp3o4:ybyibhnp3vvwuq2vaw2ckjmesgkklfs6ghxleztqidihjyofgw7q" - future_write_uri = "x-tahoe-crazy://I_am_from_the_future." - future_read_uri = "x-tahoe-crazy-readonly://I_am_from_the_future." kids = {u"one": (nm.create_from_cap(one_uri), {}), u"two": (nm.create_from_cap(setup_py_uri), {"metakey": "metavalue"}), hunk ./src/allmydata/test/test_dirnode.py 180 u"fut": (nm.create_from_cap(None, future_read_uri), {}), + u"empty_litdir": (nm.create_from_cap(empty_litdir_uri), {}), + u"tiny_litdir": (nm.create_from_cap(tiny_litdir_uri), {}), } d = c.create_immutable_dirnode(kids) hunk ./src/allmydata/test/test_dirnode.py 201 d.addCallback(_created) def _check_kids(children): - self.failUnlessEqual(sorted(children.keys()), [u"fut", u"one", u"two"]) + self.failUnlessEqual(set(children.keys()), set([u"fut", u"one", u"two", u"empty_litdir", u"tiny_litdir"])) one_node, one_metadata = children[u"one"] two_node, two_metadata = children[u"two"] fut_node, fut_metadata = children[u"fut"] hunk ./src/allmydata/test/test_dirnode.py 205 + emptylit_node, emptylit_metadata = children[u"empty_litdir"] + tinylit_node, tinylit_metadata = children[u"tiny_litdir"] self.failUnlessEqual(one_node.get_size(), 3) self.failUnlessEqual(one_node.get_uri(), one_uri) hunk ./src/allmydata/test/test_dirnode.py 222 self.failUnlessEqual(fut_node.get_uri(), "imm." + future_read_uri) self.failUnlessEqual(fut_node.get_readonly_uri(), "imm." + future_read_uri) self.failUnless(isinstance(fut_metadata, dict), fut_metadata) + + d2 = defer.succeed(None) + d2.addCallback(lambda ignored: emptylit_node.list()) + d2.addCallback(lambda children: self.failUnlessEqual(children, {})) + d2.addCallback(lambda ignored: tinylit_node.list()) + d2.addCallback(lambda children: self.failUnlessEqual(set(children.keys()), set(['short']))) + d2.addCallback(lambda ignored: tinylit_node.list()) + d2.addCallback(lambda children: children['short'][0].read(MemAccum())) + d2.addCallback(lambda accum: self.failUnlessEqual(accum.data, "The end.")) + return d2 + d.addCallback(_check_kids) d.addCallback(lambda ign: nm.create_from_cap(self.cap.to_string())) } Context: [More cleanups to test_cli using new utilities for reading and writing files. david-sarah@jacaranda.org**20100206013855 Ignore-this: 9fd2294406b346bfe9144fff6a61f789 ] [Fix race conditions and missing callback in allmydata.test.test_cli.Cp.test_copy_using_filecap, add utilities for one-liner reading and writing of files, and fix cases in test_cli where files were not being closed after writing. david-sarah@jacaranda.org**20100206013727 Ignore-this: 49da6c33190d526a4ae84c472f04d5f4 ] [setup: comment-out the dependency on pycrypto, see #953 zooko@zooko.com**20100215050844 Ignore-this: 2751120921ff35b8189d8fcd896da149 ] [Add tests for #939 Kevan Carstensen **20100212062137 Ignore-this: 5459e8c64ba76cca70aa720e68549637 ] [Alter CLI utilities to handle nonexistent aliases better Kevan Carstensen **20100211024318 Ignore-this: e698ea4a57f5fe27c24336581ca0cf65 ] [adding pycrypto to the auto dependencies secorp@allmydata.com**20100206054314 Ignore-this: b873fc00a6a5b001d30d479e6053cf2f ] [docs running.html - "tahoe run ." does not work with the current installation, replaced with "tahoe start ." secorp@allmydata.com**20100206165320 Ignore-this: fdb2dcb0e417d303cd43b1951a4f8c03 ] [web/storage.py: display total-seen on the last-complete-cycle line. For #940. Brian Warner **20100208002010 Ignore-this: c0ed860f3e9628d3171d2b055d96c5aa ] [code coverage: replace figleaf with coverage.py, should work on py2.6 now. Brian Warner **20100203165421 Ignore-this: 46ab590360be6a385cb4fc4e68b6b42c It still lacks the right HTML report (the builtin report is very pretty, but lacks the "lines uncovered" numbers that I want), and the half-finished delta-from-last-run measurements. ] [More comprehensive changes and ticket references for NEWS david-sarah@jacaranda.org**20100202061256 Ignore-this: 696cf0106e8a7fd388afc5b55fba8a1b ] [docs: install.html: link into Python 2.5.5 download page zooko@zooko.com**20100202065852 Ignore-this: 1a9471b8175b7de5741d8445a7ede29d ] [TAG allmydata-tahoe-1.6.0 zooko@zooko.com**20100202061125 Ignore-this: dee6ade7ac1452cf5d1d9c69a8146d84 ] Patch bundle hash: 563cb58440ac6de6d750b4dbf66761a4dc167317