예제 #1
0
    def _test_journal_recovery(self, operation, odl_resource, expected_state):
        db.create_pending_row(self.db_session, odl_const.ODL_NETWORK, 'id',
                              operation, {})
        row = db.get_all_db_rows(self.db_session)[0]
        db.update_db_row_state(self.db_session, row, odl_const.FAILED)

        self._CLIENT.get_resource.return_value = odl_resource

        recovery.journal_recovery(self.db_session)

        row = db.get_all_db_rows(self.db_session)[0]
        self.assertEqual(expected_state, row['state'])
예제 #2
0
    def _test_recovery(self, operation, odl_resource, expected_state):
        db.create_pending_row(self.db_context, odl_const.ODL_NETWORK,
                              'id', operation, {})
        created_row = db.get_all_db_rows(self.db_context)[0]
        db.update_db_row_state(self.db_context, created_row, odl_const.FAILED)

        self._CLIENT.get_resource.return_value = odl_resource

        recovery.journal_recovery(self.db_context)

        if expected_state is None:
            completed_rows = db.get_all_db_rows_by_state(
                self.db_context, odl_const.COMPLETED)
            self.assertEqual([], completed_rows)
        else:
            row = db.get_all_db_rows_by_state(self.db_context,
                                              expected_state)[0]
            self.assertEqual(created_row['seqnum'], row['seqnum'])

        return created_row
예제 #3
0
    def _test_recovery(self, operation, odl_resource, expected_state):
        db.create_pending_row(self.db_context, odl_const.ODL_NETWORK, 'id',
                              operation, {})
        created_row = db.get_all_db_rows(self.db_context)[0]
        db.update_db_row_state(self.db_context, created_row, odl_const.FAILED)

        self._CLIENT.get_resource.return_value = odl_resource

        recovery.journal_recovery(self.db_context)

        if expected_state is None:
            completed_rows = db.get_all_db_rows_by_state(
                self.db_context, odl_const.COMPLETED)
            self.assertEqual([], completed_rows)
        else:
            row = db.get_all_db_rows_by_state(self.db_context,
                                              expected_state)[0]
            self.assertEqual(created_row['seqnum'], row['seqnum'])

        return created_row
예제 #4
0
 def test_journal_recovery_no_rows(self):
     recovery.journal_recovery(self.db_session)
     self.assertFalse(self._CLIENT.get_resource.called)
예제 #5
0
 def test_journal_recovery_no_rows(self):
     recovery.journal_recovery(self.db_context)
     self.assertFalse(self._CLIENT.get_resource.called)