test/test_storage.py: test for the new remote_abort semantics.
authorKevan Carstensen <kevan@isnotajoke.com>
Thu, 15 Jul 2010 23:21:48 +0000 (16:21 -0700)
committerKevan Carstensen <kevan@isnotajoke.com>
Thu, 15 Jul 2010 23:21:48 +0000 (16:21 -0700)
src/allmydata/test/test_storage.py

index 594c536ab03ff1759d7430247a94749c36d442ca..c3153e857a2dc6c78d35d2aa5356f9b0de7540a9 100644 (file)
@@ -321,6 +321,20 @@ class Server(unittest.TestCase):
         self.failIf(os.path.exists(incoming_prefix_dir), incoming_prefix_dir)
         self.failUnless(os.path.exists(incoming_dir), incoming_dir)
 
+    def test_abort(self):
+        # remote_abort, when called on a writer, should make sure that
+        # the allocated size of the bucket is not counted by the storage
+        # server when accounting for space.
+        ss = self.create("test_abort")
+        already, writers = self.allocate(ss, "allocate", [0, 1, 2], 150)
+        self.failIfEqual(ss.allocated_size(), 0)
+
+        # Now abort the writers.
+        for writer in writers.itervalues():
+            writer.remote_abort()
+        self.failUnlessEqual(ss.allocated_size(), 0)
+
+
     def test_allocate(self):
         ss = self.create("test_allocate")