Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestAnnotationManagerFile.test_delete_one_of_many_annotations fails on illumos #869

Open
mtelka opened this issue Nov 10, 2023 · 0 comments

Comments

@mtelka
Copy link
Contributor

mtelka commented Nov 10, 2023

I see the following failure while testing barman 3.9.0 on OpenIndiana (an illumos distro):

________ TestAnnotationManagerFile.test_delete_one_of_many_annotations _________
    
self = <test_annotations.TestAnnotationManagerFile object at 0x7fffabe485b0>
tmpdir = local('/tmp/pytest-of-marcel/pytest-34/test_delete_one_of_many_annota0')
    
    def test_delete_one_of_many_annotations(self, tmpdir):
        """Tests we delete the correct annotation successfully"""
        base_backup_dir = tmpdir.mkdir("base")
        os.makedirs("%s/%s/annotations" % (base_backup_dir, test_backup_id))
        self._create_annotation_on_filesystem(
            base_backup_dir, test_backup_id, "test_annotation", "annotation_value"
        )
        self._create_annotation_on_filesystem(
            base_backup_dir, test_backup_id, "test_annotation_2", "annotation_value_2"
        )
        annotation_manager = AnnotationManagerFile(base_backup_dir)
>       annotation_manager.delete_annotation(test_backup_id, "test_annotation")

tests/test_annotations.py:225: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  
self = <barman.annotations.AnnotationManagerFile object at 0x7fffab92cd00>
backup_id = '20210723T095432', key = 'test_annotation'

    def delete_annotation(self, backup_id, key):
        """
        Deletes an annotation from the filesystem for the specified backup_id and
        annotation key.
        """
        annotation_path = self._get_annotation_path(backup_id, key)
        try:
            os.remove(annotation_path)
        except EnvironmentError as e:
            # For Python 2 compatibility we must check the error code directly
            # If the annotation doesn't exist then the failure to delete it is not an
            # error condition and we should not proceed to remove the annotations
            # directory
            if e.errno == errno.ENOENT:
                return
            else:
                raise
        try:
>           os.rmdir(os.path.dirname(annotation_path))
E           FileExistsError: [Errno 17] File exists: '/tmp/pytest-of-marcel/pytest-34/test_delete_one_of_many_annota0/base/20210723T095432/annotations'

barman/annotations.py:80: FileExistsError

The cause seems to be that the test barman is trying to remove non-empty directory. This is not allowed on illumos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant