More passing tests.
This commit is contained in:
parent
50007ac868
commit
2ba0854e0d
|
@ -297,7 +297,7 @@ class SDMFSlotWriteProxy(object):
|
||||||
salt)
|
salt)
|
||||||
else:
|
else:
|
||||||
checkstring = checkstring_or_seqnum
|
checkstring = checkstring_or_seqnum
|
||||||
self._testvs = [(0, len(checkstring), "eq", checkstring)]
|
self._testvs = [(0, len(checkstring), b"eq", checkstring)]
|
||||||
|
|
||||||
|
|
||||||
def get_checkstring(self):
|
def get_checkstring(self):
|
||||||
|
@ -307,7 +307,7 @@ class SDMFSlotWriteProxy(object):
|
||||||
"""
|
"""
|
||||||
if self._testvs:
|
if self._testvs:
|
||||||
return self._testvs[0][3]
|
return self._testvs[0][3]
|
||||||
return ""
|
return b""
|
||||||
|
|
||||||
|
|
||||||
def put_block(self, data, segnum, salt):
|
def put_block(self, data, segnum, salt):
|
||||||
|
@ -538,7 +538,7 @@ class SDMFSlotWriteProxy(object):
|
||||||
# yet, so we assume that we are writing a new share, and set
|
# yet, so we assume that we are writing a new share, and set
|
||||||
# a test vector that will allow a new share to be written.
|
# a test vector that will allow a new share to be written.
|
||||||
self._testvs = []
|
self._testvs = []
|
||||||
self._testvs.append(tuple([0, 1, "eq", ""]))
|
self._testvs.append(tuple([0, 1, b"eq", b""]))
|
||||||
|
|
||||||
tw_vectors = {}
|
tw_vectors = {}
|
||||||
tw_vectors[self.shnum] = (self._testvs, datavs, None)
|
tw_vectors[self.shnum] = (self._testvs, datavs, None)
|
||||||
|
@ -1195,7 +1195,7 @@ class MDMFSlotReadProxy(object):
|
||||||
storage_server,
|
storage_server,
|
||||||
storage_index,
|
storage_index,
|
||||||
shnum,
|
shnum,
|
||||||
data="",
|
data=b"",
|
||||||
data_is_everything=False):
|
data_is_everything=False):
|
||||||
# Start the initialization process.
|
# Start the initialization process.
|
||||||
self._storage_server = storage_server
|
self._storage_server = storage_server
|
||||||
|
@ -1239,7 +1239,7 @@ class MDMFSlotReadProxy(object):
|
||||||
# None if there isn't any cached data, but the way we index the
|
# None if there isn't any cached data, but the way we index the
|
||||||
# cached data requires a string, so convert None to "".
|
# cached data requires a string, so convert None to "".
|
||||||
if self._data == None:
|
if self._data == None:
|
||||||
self._data = ""
|
self._data = b""
|
||||||
|
|
||||||
|
|
||||||
def _maybe_fetch_offsets_and_header(self, force_remote=False):
|
def _maybe_fetch_offsets_and_header(self, force_remote=False):
|
||||||
|
@ -1417,7 +1417,7 @@ class MDMFSlotReadProxy(object):
|
||||||
# when we fetched the header
|
# when we fetched the header
|
||||||
data = results[self.shnum]
|
data = results[self.shnum]
|
||||||
if not data:
|
if not data:
|
||||||
data = ""
|
data = b""
|
||||||
else:
|
else:
|
||||||
if len(data) != 1:
|
if len(data) != 1:
|
||||||
raise BadShareError("got %d vectors, not 1" % len(data))
|
raise BadShareError("got %d vectors, not 1" % len(data))
|
||||||
|
@ -1426,7 +1426,7 @@ class MDMFSlotReadProxy(object):
|
||||||
else:
|
else:
|
||||||
data = results[self.shnum]
|
data = results[self.shnum]
|
||||||
if not data:
|
if not data:
|
||||||
salt = data = ""
|
salt = data = b""
|
||||||
else:
|
else:
|
||||||
salt_and_data = results[self.shnum][0]
|
salt_and_data = results[self.shnum][0]
|
||||||
salt = salt_and_data[:SALT_SIZE]
|
salt = salt_and_data[:SALT_SIZE]
|
||||||
|
|
|
@ -2409,7 +2409,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
# since it will encounter them on the grid. Callers use the
|
# since it will encounter them on the grid. Callers use the
|
||||||
# is_sdmf method to test this.
|
# is_sdmf method to test this.
|
||||||
self.write_sdmf_share_to_server(b"si1")
|
self.write_sdmf_share_to_server(b"si1")
|
||||||
mr = MDMFSlotReadProxy(self.storage_server, "si1", 0)
|
mr = MDMFSlotReadProxy(self.storage_server, b"si1", 0)
|
||||||
d = mr.is_sdmf()
|
d = mr.is_sdmf()
|
||||||
d.addCallback(lambda issdmf:
|
d.addCallback(lambda issdmf:
|
||||||
self.failUnless(issdmf))
|
self.failUnless(issdmf))
|
||||||
|
@ -2420,7 +2420,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
# The slot read proxy should, naturally, know how to tell us
|
# The slot read proxy should, naturally, know how to tell us
|
||||||
# about data in the SDMF format
|
# about data in the SDMF format
|
||||||
self.write_sdmf_share_to_server(b"si1")
|
self.write_sdmf_share_to_server(b"si1")
|
||||||
mr = MDMFSlotReadProxy(self.storage_server, "si1", 0)
|
mr = MDMFSlotReadProxy(self.storage_server, b"si1", 0)
|
||||||
d = defer.succeed(None)
|
d = defer.succeed(None)
|
||||||
d.addCallback(lambda ignored:
|
d.addCallback(lambda ignored:
|
||||||
mr.is_sdmf())
|
mr.is_sdmf())
|
||||||
|
@ -2491,7 +2491,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
# read more segments than that. The reader should know this and
|
# read more segments than that. The reader should know this and
|
||||||
# complain if we try to do that.
|
# complain if we try to do that.
|
||||||
self.write_sdmf_share_to_server(b"si1")
|
self.write_sdmf_share_to_server(b"si1")
|
||||||
mr = MDMFSlotReadProxy(self.storage_server, "si1", 0)
|
mr = MDMFSlotReadProxy(self.storage_server, b"si1", 0)
|
||||||
d = defer.succeed(None)
|
d = defer.succeed(None)
|
||||||
d.addCallback(lambda ignored:
|
d.addCallback(lambda ignored:
|
||||||
mr.is_sdmf())
|
mr.is_sdmf())
|
||||||
|
@ -2513,7 +2513,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
mdmf_data = self.build_test_mdmf_share()
|
mdmf_data = self.build_test_mdmf_share()
|
||||||
self.write_test_share_to_server(b"si1")
|
self.write_test_share_to_server(b"si1")
|
||||||
def _make_mr(ignored, length):
|
def _make_mr(ignored, length):
|
||||||
mr = MDMFSlotReadProxy(self.storage_server, "si1", 0, mdmf_data[:length])
|
mr = MDMFSlotReadProxy(self.storage_server, b"si1", 0, mdmf_data[:length])
|
||||||
return mr
|
return mr
|
||||||
|
|
||||||
d = defer.succeed(None)
|
d = defer.succeed(None)
|
||||||
|
@ -2574,7 +2574,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
sdmf_data = self.build_test_sdmf_share()
|
sdmf_data = self.build_test_sdmf_share()
|
||||||
self.write_sdmf_share_to_server(b"si1")
|
self.write_sdmf_share_to_server(b"si1")
|
||||||
def _make_mr(ignored, length):
|
def _make_mr(ignored, length):
|
||||||
mr = MDMFSlotReadProxy(self.storage_server, "si1", 0, sdmf_data[:length])
|
mr = MDMFSlotReadProxy(self.storage_server, b"si1", 0, sdmf_data[:length])
|
||||||
return mr
|
return mr
|
||||||
|
|
||||||
d = defer.succeed(None)
|
d = defer.succeed(None)
|
||||||
|
@ -2640,7 +2640,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
# unrelated to the actual handling of the content of the file.
|
# unrelated to the actual handling of the content of the file.
|
||||||
# The reader should behave intelligently in these cases.
|
# The reader should behave intelligently in these cases.
|
||||||
self.write_test_share_to_server(b"si1", empty=True)
|
self.write_test_share_to_server(b"si1", empty=True)
|
||||||
mr = MDMFSlotReadProxy(self.storage_server, "si1", 0)
|
mr = MDMFSlotReadProxy(self.storage_server, b"si1", 0)
|
||||||
# We should be able to get the encoding parameters, and they
|
# We should be able to get the encoding parameters, and they
|
||||||
# should be correct.
|
# should be correct.
|
||||||
d = defer.succeed(None)
|
d = defer.succeed(None)
|
||||||
|
@ -2666,7 +2666,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
|
|
||||||
def test_read_with_empty_sdmf_file(self):
|
def test_read_with_empty_sdmf_file(self):
|
||||||
self.write_sdmf_share_to_server(b"si1", empty=True)
|
self.write_sdmf_share_to_server(b"si1", empty=True)
|
||||||
mr = MDMFSlotReadProxy(self.storage_server, "si1", 0)
|
mr = MDMFSlotReadProxy(self.storage_server, b"si1", 0)
|
||||||
# We should be able to get the encoding parameters, and they
|
# We should be able to get the encoding parameters, and they
|
||||||
# should be correct
|
# should be correct
|
||||||
d = defer.succeed(None)
|
d = defer.succeed(None)
|
||||||
|
@ -2692,7 +2692,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
|
|
||||||
def test_verinfo_with_sdmf_file(self):
|
def test_verinfo_with_sdmf_file(self):
|
||||||
self.write_sdmf_share_to_server(b"si1")
|
self.write_sdmf_share_to_server(b"si1")
|
||||||
mr = MDMFSlotReadProxy(self.storage_server, "si1", 0)
|
mr = MDMFSlotReadProxy(self.storage_server, b"si1", 0)
|
||||||
# We should be able to get the version information.
|
# We should be able to get the version information.
|
||||||
d = defer.succeed(None)
|
d = defer.succeed(None)
|
||||||
d.addCallback(lambda ignored:
|
d.addCallback(lambda ignored:
|
||||||
|
@ -2733,7 +2733,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
|
|
||||||
def test_verinfo_with_mdmf_file(self):
|
def test_verinfo_with_mdmf_file(self):
|
||||||
self.write_test_share_to_server(b"si1")
|
self.write_test_share_to_server(b"si1")
|
||||||
mr = MDMFSlotReadProxy(self.storage_server, "si1", 0)
|
mr = MDMFSlotReadProxy(self.storage_server, b"si1", 0)
|
||||||
d = defer.succeed(None)
|
d = defer.succeed(None)
|
||||||
d.addCallback(lambda ignored:
|
d.addCallback(lambda ignored:
|
||||||
mr.get_verinfo())
|
mr.get_verinfo())
|
||||||
|
@ -2780,7 +2780,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
data = self.build_test_sdmf_share()
|
data = self.build_test_sdmf_share()
|
||||||
sdmfr = SDMFSlotWriteProxy(0,
|
sdmfr = SDMFSlotWriteProxy(0,
|
||||||
self.storage_server,
|
self.storage_server,
|
||||||
"si1",
|
b"si1",
|
||||||
self.secrets,
|
self.secrets,
|
||||||
0, 3, 10, 36, 36)
|
0, 3, 10, 36, 36)
|
||||||
# Put the block and salt.
|
# Put the block and salt.
|
||||||
|
@ -2823,7 +2823,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
# don't, no write should occur.
|
# don't, no write should occur.
|
||||||
sdmfw = SDMFSlotWriteProxy(0,
|
sdmfw = SDMFSlotWriteProxy(0,
|
||||||
self.storage_server,
|
self.storage_server,
|
||||||
"si1",
|
b"si1",
|
||||||
self.secrets,
|
self.secrets,
|
||||||
1, 3, 10, 36, 36)
|
1, 3, 10, 36, 36)
|
||||||
sdmfw.put_block(self.blockdata, 0, self.salt)
|
sdmfw.put_block(self.blockdata, 0, self.salt)
|
||||||
|
@ -2845,7 +2845,7 @@ class MDMFProxies(unittest.TestCase, ShouldFailMixin):
|
||||||
sdmfw.put_verification_key(self.verification_key)
|
sdmfw.put_verification_key(self.verification_key)
|
||||||
|
|
||||||
# We shouldn't have a checkstring yet
|
# We shouldn't have a checkstring yet
|
||||||
self.failUnlessEqual(sdmfw.get_checkstring(), "")
|
self.failUnlessEqual(sdmfw.get_checkstring(), b"")
|
||||||
|
|
||||||
d = sdmfw.finish_publishing()
|
d = sdmfw.finish_publishing()
|
||||||
def _then(results):
|
def _then(results):
|
||||||
|
|
Loading…
Reference in New Issue