From: Kevan Carstensen <kevan@isnotajoke.com>
Date: Thu, 15 Jul 2010 23:21:48 +0000 (-0700)
Subject: test/test_storage.py: test for the new remote_abort semantics.
X-Git-Tag: allmydata-tahoe-1.7.1~15
X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/frontends/flags?a=commitdiff_plain;h=677f3b1f63f549fc3f1bd04d3613d0baf57ea57c;p=tahoe-lafs%2Ftahoe-lafs.git

test/test_storage.py: test for the new remote_abort semantics.
---

diff --git a/src/allmydata/test/test_storage.py b/src/allmydata/test/test_storage.py
index 594c536a..c3153e85 100644
--- a/src/allmydata/test/test_storage.py
+++ b/src/allmydata/test/test_storage.py
@@ -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")