self.failUnlessEqual(already, set())
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):