From: nejucomo Date: Wed, 30 Jan 2008 09:59:43 +0000 (-0700) Subject: tahoe_fuse: system test: Populate a testdir with files and empty children directories... X-Git-Tag: allmydata-tahoe-0.8.0~162 X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/running.html?a=commitdiff_plain;h=28552e5967f4e3757c6bb1c951efefc58835cf11;p=tahoe-lafs%2Ftahoe-lafs.git tahoe_fuse: system test: Populate a testdir with files and empty children directories, then test the fuse interface for proper listings and size metadata. --- diff --git a/contrib/fuse/runtests.py b/contrib/fuse/runtests.py index 35b8ca00..feee949e 100644 --- a/contrib/fuse/runtests.py +++ b/contrib/fuse/runtests.py @@ -260,8 +260,43 @@ class SystemTest (object): def test_empty_directory_listing(self, testcap, testdir): listing = os.listdir(testdir) if listing: - raise self.TestFailure('Expected empty directory, found: %r' % (listing,)) + raise self.TestFailure('Expected empty directory, found: %r', listing) + def test_directory_listing(self, testcap, testdir): + names = [] + filesizes = {} + + for i in range(3): + fname = 'file_%d' % (i,) + names.append(fname) + body = 'Hello World #%d!' % (i,) + filesizes[fname] = len(body) + + cap = self.webapi_call('PUT', '/uri', body) + self.attach_node(testcap, cap, fname) + + + dname = 'dir_%d' % (i,) + names.append(dname) + + cap = self.create_dirnode() + self.attach_node(testcap, cap, dname) + + names.sort() + + listing = os.listdir(testdir) + listing.sort() + if listing != names: + tmpl = 'Expected directory list containing %r but fuse gave %r' + raise self.TestFailure(tmpl, names, listing) + + for file, size in filesizes.items(): + st = os.stat(os.path.join(testdir, file)) + if st.st_size != size: + tmpl = 'Expected %r size of %r but fuse returned %r' + raise self.TestFailure(tmpl, file, size, st.st_size) + + # Utilities: def run_tahoe(self, *args): realargs = ('tahoe',) + args