Ejemplo n.º 1
0
    def test_should_fail_if_file_was_not_uploaded_at_all(self):
        dag = self._prepare_file_transfer_dag()
        dag.id = '1'

        tasks = [
            TaskLog(id='before_1', workflow='1', task_id='before', started=0.0, finished=10.0,
                vm=1, result='OK'),
            TaskLog(id='after_1', workflow='1', task_id='after', started=13.0, finished=18.0,
                vm=1, result='OK')]

        transfers = [
            TransferLog(
                id='234', job_id='after_1', vm=1, started=12.0,
                finished=13.0, direction='DOWNLOAD', file_id='transferred.txt')]

        result = order_validator.validate_transfers(dag, tasks, transfers)
        self.assertFalse(result.is_valid)
Ejemplo n.º 2
0
    def test_should_pass_if_transfers_are_ok(self):
        dag = self._prepare_file_transfer_dag()
        dag.id = '1'

        tasks = [
            TaskLog(id='before_1', workflow='1', task_id='before', started=0.0, finished=10.0,
                vm=1, result='OK'),
            TaskLog(id='after_1', workflow='1', task_id='after', started=13.0, finished=18.0,
                vm=1, result='OK')]

        transfers = [
            TransferLog(id='123', job_id='before_1', vm=1, started=10.0, finished=12.0,
                direction='UPLOAD', file_id='transferred.txt'),
            TransferLog(id='234', job_id='after_1', vm=1, started=12.0, finished=13.0,
                direction='DOWNLOAD', file_id='transferred.txt')]

        result = order_validator.validate_transfers(dag, tasks, transfers)
        self.assertTrue(result.is_valid)
        self.assertListEqual([], result.errors)