Merge branch markberger/ticket-2008
This changes test_upload.py to delete-all-shares more gently, leaving the 'incoming' directory in place, which should help the rest of the test pass. Closes tahoe-lafs/tahoe-lafs#50 (github PR) Closes ticket:2008 (trac)
This commit is contained in:
commit
3cfbe1cfc0
|
@ -13,7 +13,7 @@
|
||||||
# Tubs, so it is not useful for tests that involve a Helper, a KeyGenerator,
|
# Tubs, so it is not useful for tests that involve a Helper, a KeyGenerator,
|
||||||
# or the control.furl .
|
# or the control.furl .
|
||||||
|
|
||||||
import os.path
|
import os
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
from twisted.application import service
|
from twisted.application import service
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer, reactor
|
||||||
|
@ -401,6 +401,12 @@ class GridTestMixin:
|
||||||
if i_shnum in shnums:
|
if i_shnum in shnums:
|
||||||
os.unlink(i_sharefile)
|
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):
|
def corrupt_share(self, (shnum, serverid, sharefile), corruptor_function):
|
||||||
sharedata = open(sharefile, "rb").read()
|
sharedata = open(sharefile, "rb").read()
|
||||||
corruptdata = corruptor_function(sharedata)
|
corruptdata = corruptor_function(sharedata)
|
||||||
|
|
|
@ -1887,11 +1887,7 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin,
|
||||||
self._add_server_with_share(server_number=3, share_number=1)
|
self._add_server_with_share(server_number=3, share_number=1)
|
||||||
# Copy shares
|
# Copy shares
|
||||||
self._copy_share_to_server(3, 1)
|
self._copy_share_to_server(3, 1)
|
||||||
storedir = self.get_serverdir(0)
|
self.delete_all_shares(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)
|
|
||||||
client = self.g.clients[0]
|
client = self.g.clients[0]
|
||||||
client.encoding_params['happy'] = 4
|
client.encoding_params['happy'] = 4
|
||||||
return client
|
return client
|
||||||
|
@ -1928,11 +1924,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin,
|
||||||
self._add_server_with_share(server_number=3, share_number=1)
|
self._add_server_with_share(server_number=3, share_number=1)
|
||||||
# Copy shares
|
# Copy shares
|
||||||
self._copy_share_to_server(3, 1)
|
self._copy_share_to_server(3, 1)
|
||||||
storedir = self.get_serverdir(0)
|
#Remove shares from server 0
|
||||||
# remove the storedir, wiping out any existing shares
|
self.delete_all_shares(self.get_serverdir(0))
|
||||||
shutil.rmtree(storedir)
|
|
||||||
# create an empty storedir to replace the one we just removed
|
|
||||||
os.mkdir(storedir)
|
|
||||||
client = self.g.clients[0]
|
client = self.g.clients[0]
|
||||||
client.encoding_params['happy'] = 4
|
client.encoding_params['happy'] = 4
|
||||||
return client
|
return client
|
||||||
|
|
Loading…
Reference in New Issue