[Checkins] SVN: gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py fixed tests for closing a RAID storage

Thomas Lotze tl at gocept.com
Wed Jan 7 08:20:09 EST 2009


Log message for revision 94574:
  fixed tests for closing a RAID storage

Changed:
  U   gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py

-=-
Modified: gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py	2009-01-07 12:54:32 UTC (rev 94573)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py	2009-01-07 13:20:09 UTC (rev 94574)
@@ -244,20 +244,28 @@
 
     def test_close_degrading(self):
         # See the comment on `test_close_failing`.
-        self._storage.storages[self._storage.storages_optimal[0]].fail('close')
+        backend = self._backend(0)
+        backend.close = raise_exception
         self._storage.close()
-        self.assertEquals([], self._storage.storages_degraded)
         self.assertEquals(True, self._storage.closed)
+        del backend.close
+        backend.close()
 
     def test_close_failing(self):
-        # Even though we make the server-side storage fail, we do not get
+        # Even though we make the server-side storage fail, we do not
         # receive an error or a degradation because the result of the failure
         # is that the connection is closed. This is actually what we wanted.
         # Unfortunately that means that an error can be hidden while closing.
-        self._backend(0).fail('close')
-        self._backend(1).fail('close')
+        backend0 = self._backend(0)
+        backend1 = self._backend(1)
+        backend0.close = raise_exception
+        backend1.close = raise_exception
         self._storage.close()
         self.assertEquals(True, self._storage.closed)
+        del backend0.close
+        del backend1.close
+        backend0.close()
+        backend1.close()
 
     def test_close_server_missing(self):
         # See the comment on `test_close_failing`.
@@ -1377,6 +1385,10 @@
         pass
 
 
+def raise_exception():
+    raise Exception()
+
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(ZEOReplicationStorageTests, "check"))



More information about the Checkins mailing list