예제 #1
0
    def test_large_rewind(self):
        """
        We should notify if the seq is significantly less than the previous and not update the seq
        """
        seq = '{}-blahblah'.format(EPSILON + 10)
        self.pillow.set_checkpoint({'seq': seq})
        HistoricalPillowCheckpoint.create_checkpoint_snapshot(self.pillow.checkpoint)

        seq_rewind = '9-blahblah'
        self.pillow.set_checkpoint({'seq': seq_rewind})
        HistoricalPillowCheckpoint.create_checkpoint_snapshot(self.pillow.checkpoint)

        has_rewound, historical_seq = check_for_rewind(self.pillow.checkpoint)
        self.assertTrue(has_rewound)
        self.assertEqual(historical_seq, seq)
예제 #2
0
    def test_large_rewind(self):
        """
        We should notify if the seq is significantly less than the previous and not update the seq
        """
        seq = '{}-blahblah'.format(EPSILON + 10)
        self.pillow.set_checkpoint({'seq': seq})
        HistoricalPillowCheckpoint.create_checkpoint_snapshot(self.pillow.checkpoint)

        seq_rewind = '9-blahblah'
        self.pillow.set_checkpoint({'seq': seq_rewind})
        HistoricalPillowCheckpoint.create_checkpoint_snapshot(self.pillow.checkpoint)

        has_rewound, historical_seq = check_for_rewind(self.pillow.checkpoint)
        self.assertTrue(has_rewound)
        self.assertEqual(historical_seq, seq)
예제 #3
0
    def test_small_rewind(self):
        """
        We should not notify if the seq is not significantly less than the previous
        """
        seq = '10-blahblah'
        self.pillow.set_checkpoint({'seq': seq})
        HistoricalPillowCheckpoint.create_checkpoint_snapshot(self.pillow.checkpoint)

        seq_rewind = '9-blahblah'
        self.pillow.set_checkpoint({'seq': seq_rewind})
        HistoricalPillowCheckpoint.create_checkpoint_snapshot(self.pillow.checkpoint)

        has_rewound, historical_seq = check_for_rewind(self.pillow.checkpoint)
        self.assertFalse(has_rewound)
        self.assertEqual(historical_seq, seq)
예제 #4
0
    def test_small_rewind(self):
        """
        We should not notify if the seq is not significantly less than the previous
        """
        seq = '10-blahblah'
        self.pillow.set_checkpoint({'seq': seq})
        HistoricalPillowCheckpoint.create_checkpoint_snapshot(self.pillow.checkpoint)

        seq_rewind = '9-blahblah'
        self.pillow.set_checkpoint({'seq': seq_rewind})
        HistoricalPillowCheckpoint.create_checkpoint_snapshot(self.pillow.checkpoint)

        has_rewound, historical_seq = check_for_rewind(self.pillow.checkpoint)
        self.assertFalse(has_rewound)
        self.assertEqual(historical_seq, seq)