Beispiel #1
0
 def test_legacy_file_exist(self):
     """
     Test the legacy behaviour
     :return:
     """
     # Given
     logging.info("Test for existing file with the legacy behaviour")
     # When
     task = HdfsSensor(task_id='Should_be_file_legacy',
                       filepath='/datadirectory/datafile',
                       timeout=1,
                       retry_delay=timedelta(seconds=1),
                       poke_interval=1,
                       hook=self.hook)
     task.execute(None)
Beispiel #2
0
 def test_legacy_file_exist(self):
     """
     Test the legacy behaviour
     :return:
     """
     # Given
     logging.info("Test for existing file with the legacy behaviour")
     # When
     task = HdfsSensor(task_id='Should_be_file_legacy',
                       filepath='/datadirectory/datafile',
                       timeout=1,
                       retry_delay=timedelta(seconds=1),
                       poke_interval=1,
                       hook=self.hook)
     task.execute(None)
    def test_legacy_file_does_not_exists(self):
        """
        Test the legacy behaviour
        :return:
        """
        # Given
        logging.info("Test for non existing file with the legacy behaviour")
        task = HdfsSensor(task_id='Should_not_be_file_legacy',
                          filepath='/datadirectory/not_existing_file_or_directory',
                          timeout=1,
                          retry_delay=timedelta(seconds=1),
                          poke_interval=1,
                          hook=self.hook)

        # When
        # Then
        with self.assertRaises(AirflowSensorTimeout):
            task.execute(None)
Beispiel #4
0
    def test_legacy_file_does_not_exists(self):
        """
        Test the legacy behaviour
        :return:
        """
        # Given
        logging.info("Test for non existing file with the legacy behaviour")
        task = HdfsSensor(task_id='Should_not_be_file_legacy',
                          filepath='/datadirectory/not_existing_file_or_directory',
                          timeout=1,
                          retry_delay=timedelta(seconds=1),
                          poke_interval=1,
                          hook=self.hook)

        # When
        # Then
        with self.assertRaises(AirflowSensorTimeout):
            task.execute(None)
Beispiel #5
0
    def test_legacy_file_exist_but_filesize(self):
        """
        Test the legacy behaviour with the filesize
        :return:
        """
        # Given
        logging.info("Test for existing file with the legacy behaviour")
        # When
        task = HdfsSensor(task_id='Should_be_file_legacy',
                          filepath='/datadirectory/datafile',
                          timeout=1,
                          file_size=20,
                          retry_delay=timedelta(seconds=1),
                          poke_interval=1,
                          hook=self.hook)

        # When
        # Then
        with self.assertRaises(AirflowSensorTimeout):
            task.execute(None)
Beispiel #6
0
    def test_legacy_file_exist_but_filesize(self):
        """
        Test the legacy behaviour with the filesize
        :return:
        """
        # Given
        logging.info("Test for existing file with the legacy behaviour")
        # When
        task = HdfsSensor(task_id='Should_be_file_legacy',
                          filepath='/datadirectory/datafile',
                          timeout=1,
                          file_size=20,
                          retry_delay=timedelta(seconds=1),
                          poke_interval=1,
                          hook=self.hook)

        # When
        # Then
        with self.assertRaises(AirflowSensorTimeout):
            task.execute(None)