示例#1
0
    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)
示例#2
0
    def test_should_be_empty_directory_fail(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_empty_directory_fail',
                                filepath='/datadirectory/not_empty_directory',
                                be_empty=True,
                                timeout=1,
                                retry_delay=timedelta(seconds=1),
                                poke_interval=1,
                                hook=self.hook)

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