]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Adds delete_all_shares
authorMark Berger <mark.berger.j@gmail.com>
Mon, 24 Jun 2013 22:28:05 +0000 (18:28 -0400)
committerBrian Warner <warner@lothar.com>
Wed, 3 Sep 2014 01:48:39 +0000 (18:48 -0700)
src/allmydata/test/no_network.py

index 7c9049192fd0a22ca9de1415d13b27f0139ae0b2..8dd9a2f957a2a91469590db66849ea5984ba45ec 100644 (file)
@@ -13,7 +13,7 @@
 # Tubs, so it is not useful for tests that involve a Helper, a KeyGenerator,
 # or the control.furl .
 
-import os.path
+import os
 from zope.interface import implements
 from twisted.application import service
 from twisted.internet import defer, reactor
@@ -401,6 +401,12 @@ class GridTestMixin:
             if i_shnum in shnums:
                 os.unlink(i_sharefile)
 
+    def delete_all_shares(self, serverdir):
+        sharedir = os.path.join(serverdir, "shares")
+        for prefixdir in os.listdir(sharedir):
+            if prefixdir != 'incoming':
+                fileutil.rm_dir(os.path.join(sharedir, prefixdir))
+
     def corrupt_share(self, (shnum, serverid, sharefile), corruptor_function):
         sharedata = open(sharefile, "rb").read()
         corruptdata = corruptor_function(sharedata)