예제 #1
0
    def test_action_mark_cancelled_parent_status_update_not_needed(self):
        timestamp = time.time()
        id_of = self._prepare_action_mark_failed_cancel()
        db_api.action_mark_cancelled(self.ctx, id_of['A03'], timestamp)

        action = db_api.action_get(self.ctx, id_of['A01'])
        self.assertEqual(consts.ACTION_WAITING, action.status)
        self.assertIsNone(action.end_time)

        result = db_api.dependency_get_dependents(self.ctx, id_of['A01'])
        self.assertEqual(3, len(result))
예제 #2
0
    def test_action_mark_cancelled_parent_status_update_needed(self):
        timestamp = time.time()
        id_of = self._prepare_action_mark_failed_cancel()
        db_api.action_mark_cancelled(self.ctx, id_of['A04'], timestamp)

        action = db_api.action_get(self.ctx, id_of['A01'])
        self.assertEqual(consts.ACTION_CANCELLED, action.status)
        self.assertEqual(round(timestamp, 6), float(action.end_time))

        result = db_api.dependency_get_dependents(self.ctx, id_of['A01'])
        self.assertEqual(0, len(result))
예제 #3
0
    def test_action_mark_cancelled(self):
        timestamp = time.time()
        id_of = self._prepare_action_mark_failed_cancel()
        db_api.action_mark_cancelled(self.ctx, id_of['A01'], timestamp)

        for aid in [id_of['A05'], id_of['A06'], id_of['A07']]:
            action = db_api.action_get(self.ctx, aid)
            self.assertEqual(consts.ACTION_CANCELLED, action.status)
            self.assertEqual(timestamp, action.end_time)

        result = db_api.dependency_get_dependents(self.ctx, id_of['A01'])
        self.assertEqual(0, len(result))
예제 #4
0
    def test_action_mark_cancelled(self):
        timestamp = time.time()
        id_of = self._prepare_action_mark_failed_cancel()
        db_api.action_mark_cancelled(self.ctx, id_of['A01'], timestamp)

        for aid in [id_of['A05'], id_of['A06'], id_of['A07']]:
            action = db_api.action_get(self.ctx, aid)
            self.assertEqual(consts.ACTION_CANCELLED, action.status)
            self.assertEqual(timestamp, action.end_time)

        result = db_api.dependency_get_dependents(self.ctx, id_of['A01'])
        self.assertEqual(0, len(result))
예제 #5
0
    def test_action_mark_cancelled(self):
        timestamp = time.time()
        id_of = self._prepare_action_mark_failed_cancel()
        db_api.action_mark_cancelled(self.ctx, id_of['action_002'], timestamp)

        for id in [id_of['action_003'],
                   id_of['action_004']]:
            action = db_api.action_get(self.ctx, id)
            self.assertEqual(db_api.ACTION_INIT, action.status)

        for id in [id_of['action_002'],
                   id_of['action_001'],
                   id_of['action_005'],
                   id_of['action_006'],
                   id_of['action_007']]:
            action = db_api.action_get(self.ctx, id)
            self.assertEqual(db_api.ACTION_CANCELED, action.status)
            self.assertEqual(timestamp, action.end_time)