Browse Source

[2856] Test UPDATING -> SYNCHRONIZING with and without events in the queue

Mukund Sivaraman 12 years ago
parent
commit
e68217dd34
1 changed files with 12 additions and 2 deletions
  1. 12 2
      src/lib/python/isc/memmgr/tests/datasrc_info_tests.py

+ 12 - 2
src/lib/python/isc/memmgr/tests/datasrc_info_tests.py

@@ -100,15 +100,25 @@ class TestSegmentInfo(unittest.TestCase):
         # in UPDATING state this is the same as calling
         # self.__si_to_synchronizing_state(), but let's try to be
         # descriptive
+        #
+        # a) with no events
         self.__si_to_updating_state()
-        self.__sgmt_info.complete_update()
+        e = self.__sgmt_info.complete_update()
+        self.assertIsNone(e)
+        self.assertEqual(self.__sgmt_info.get_state(), SegmentInfo.SYNCHRONIZING)
+
+        # b) with events
+        self.__si_to_updating_state()
+        self.__sgmt_info.add_event((81,))
+        e = self.__sgmt_info.complete_update()
+        self.assertIsNone(e) # old_readers is not empty
         self.assertEqual(self.__sgmt_info.get_state(), SegmentInfo.SYNCHRONIZING)
 
         # in SYNCHRONIZING state
         self.__si_to_synchronizing_state()
         self.assertRaises(SegmentInfoError, self.__sgmt_info.complete_update)
 
-        # in COPYING state
+        # in COPYING state with no events
         self.__si_to_copying_state()
         self.__sgmt_info.complete_update()
         self.assertEqual(self.__sgmt_info.get_state(), SegmentInfo.READY)