def test_should_be_a_non_empty_directory(self):
        """
        test the empty directory behaviour
        :return:
        """
        # Given
        self.log.debug('#' * 10)
        self.log.debug('Running %s', self._testMethodName)
        self.log.debug('#' * 10)
        task = HdfsSensorFolder(task_id='Should_be_non_empty_directory',
                                filepath='/datadirectory/not_empty_directory',
                                timeout=1,
                                retry_delay=timedelta(seconds=1),
                                poke_interval=1,
                                hook=self.hook)

        # When
        task.execute(None)
    def test_should_be_a_non_empty_directory(self):
        """
        test the empty directory behaviour
        :return:
        """
        # Given
        self.log.debug('#' * 10)
        self.log.debug('Running %s', self._testMethodName)
        self.log.debug('#' * 10)
        task = HdfsSensorFolder(task_id='Should_be_non_empty_directory',
                                filepath='/datadirectory/not_empty_directory',
                                timeout=1,
                                retry_delay=timedelta(seconds=1),
                                poke_interval=1,
                                hook=self.hook)

        # When
        task.execute(None)
    def test_should_be_non_empty_directory_fail(self):
        """
        test the empty directory behaviour
        :return:
        """
        # Given
        self.logger.debug('#' * 10)
        self.logger.debug('Running %s', self._testMethodName)
        self.logger.debug('#' * 10)
        task = HdfsSensorFolder(task_id='Should_be_empty_directory_fail',
                                filepath='/datadirectory/empty_directory',
                                timeout=1,
                                retry_delay=timedelta(seconds=1),
                                poke_interval=1,
                                hook=self.hook)

        # When
        # Then
        with self.assertRaises(AirflowSensorTimeout):
            task.execute(None)
Exemple #4
0
    def test_should_be_non_empty_directory_fail(self):
        """
        test the empty directory behaviour
        :return:
        """
        # Given
        self.logger.debug('#' * 10)
        self.logger.debug('Running %s', self._testMethodName)
        self.logger.debug('#' * 10)
        task = HdfsSensorFolder(task_id='Should_be_empty_directory_fail',
                                filepath='/datadirectory/empty_directory',
                                timeout=1,
                                retry_delay=timedelta(seconds=1),
                                poke_interval=1,
                                hook=self.hook)

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