]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2856] Test UPDATING -> SYNCHRONIZING with and without events in the queue
authorMukund Sivaraman <muks@isc.org>
Mon, 8 Jul 2013 12:01:53 +0000 (17:31 +0530)
committerMukund Sivaraman <muks@isc.org>
Mon, 8 Jul 2013 12:01:53 +0000 (17:31 +0530)
src/lib/python/isc/memmgr/tests/datasrc_info_tests.py

index 955261281603c4ce9021bf4d58d5deb6ad9b4080..291e023a6762ca707d8f2279fc8c7478c1bc6263 100644 (file)
@@ -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)