mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-22 10:20:59 +00:00
test_storage: add coverage for discard_storage
This commit is contained in:
parent
75e662cc46
commit
2154b5751b
@ -499,6 +499,26 @@ class Server(unittest.TestCase):
|
|||||||
self.failUnlessEqual(already, set())
|
self.failUnlessEqual(already, set())
|
||||||
self.failUnlessEqual(writers, {})
|
self.failUnlessEqual(writers, {})
|
||||||
|
|
||||||
|
def test_discard(self):
|
||||||
|
# discard is really only used for other tests, but we test it anyways
|
||||||
|
workdir = self.workdir("test_discard")
|
||||||
|
ss = StorageServer(workdir, discard_storage=True)
|
||||||
|
ss.setServiceParent(self.sparent)
|
||||||
|
|
||||||
|
canary = FakeCanary()
|
||||||
|
already,writers = self.allocate(ss, "vid", [0,1,2], 75)
|
||||||
|
self.failUnlessEqual(already, set())
|
||||||
|
self.failUnlessEqual(set(writers.keys()), set([0,1,2]))
|
||||||
|
for i,wb in writers.items():
|
||||||
|
wb.remote_write(0, "%25d" % i)
|
||||||
|
wb.remote_close()
|
||||||
|
# since we discard the data, the shares should be present but sparse.
|
||||||
|
# Since we write with some seeks, the data we read back will be all
|
||||||
|
# zeros.
|
||||||
|
b = ss.remote_get_buckets("vid")
|
||||||
|
self.failUnlessEqual(set(b.keys()), set([0,1,2]))
|
||||||
|
self.failUnlessEqual(b[0].remote_read(0, 25), "\x00" * 25)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MutableServer(unittest.TestCase):
|
class MutableServer(unittest.TestCase):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user