From: Mark Berger <mark.berger.j@gmail.com>
Date: Mon, 24 Jun 2013 20:44:40 +0000 (-0400)
Subject: Deletes shares from server 0 correctly
X-Git-Tag: allmydata-tahoe-1.10.1a1~148^2~3
X-Git-Url: https://git.rkrishnan.org/specifications/components/com_hotproperty/css?a=commitdiff_plain;h=1467eb53b914da967a03515429b1edef9378d40c;p=tahoe-lafs%2Ftahoe-lafs.git

Deletes shares from server 0 correctly

Deletes the shares from server 0 without setting the remaining
size to 0
---

diff --git a/src/allmydata/test/test_upload.py b/src/allmydata/test/test_upload.py
index c0ec2468..b6ca3bbf 100644
--- a/src/allmydata/test/test_upload.py
+++ b/src/allmydata/test/test_upload.py
@@ -11,7 +11,7 @@ import allmydata # for __full_version__
 from allmydata import uri, monitor, client
 from allmydata.immutable import upload, encode
 from allmydata.interfaces import FileTooLargeError, UploadUnhappinessError
-from allmydata.util import log, base32
+from allmydata.util import log, base32, fileutil
 from allmydata.util.assertutil import precondition
 from allmydata.util.deferredutil import DeferredListShouldSucceed
 from allmydata.test.no_network import GridTestMixin
@@ -1928,11 +1928,11 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin,
             self._add_server_with_share(server_number=3, share_number=1)
             # Copy shares
             self._copy_share_to_server(3, 1)
-            storedir = self.get_serverdir(0)
-            # remove the storedir, wiping out any existing shares
-            shutil.rmtree(storedir)
-            # create an empty storedir to replace the one we just removed
-            os.mkdir(storedir)
+            #Remove shares from server 0
+            sharedir = os.path.join(self.get_serverdir(0), "shares")
+            for prefixdir in os.listdir(sharedir):
+                if prefixdir != 'incoming':
+                    fileutil.rm_dir(os.path.join(sharedir, prefixdir))
             client = self.g.clients[0]
             client.encoding_params['happy'] = 4
             return client