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

Some tests failed in container environments #4

Open
3 tasks done
guoyunhe opened this issue Oct 28, 2024 · 1 comment
Open
3 tasks done

Some tests failed in container environments #4

guoyunhe opened this issue Oct 28, 2024 · 1 comment

Comments

@guoyunhe
Copy link

We are happy to answer your questions about the code or discuss technical ideas.

Please complete the following checklist (by adding [x]):

  • I have searched open and closed issues for duplicates
  • This isn't a feature request
  • This is not a report about my app not working as expected

I am trying to updating this package on openSUSE RPM repository. Some of the tests are failing because the code cannot access /var/user in the container environment:

[    6s] tests/connection/test_vpnconfiguration.py:111: 
[    6s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[    6s] proton/vpn/connection/vpnconfiguration.py:64: in __enter__
[    6s]     self._delete_existing_configuration()
[    6s] proton/vpn/connection/vpnconfiguration.py:89: in _delete_existing_configuration
[    6s]     for file in self.__base_path:
[    6s] proton/vpn/connection/vpnconfiguration.py:99: in __base_path
[    6s]     return ExecutionEnvironment().path_runtime
[    6s] /usr/lib/python3.10/site-packages/proton/utils/environment.py:57: in path_runtime
[    6s]     self.generate_dirs(self._path_runtime)
[    6s] /usr/lib/python3.10/site-packages/proton/utils/environment.py:68: in generate_dirs
[    6s]     os.makedirs(path, mode=0o700, exist_ok=True)
[    6s] /usr/lib64/python3.10/os.py:215: in makedirs
[    6s]     makedirs(head, exist_ok=exist_ok)
[    6s] /usr/lib64/python3.10/os.py:215: in makedirs
[    6s]     makedirs(head, exist_ok=exist_ok)
[    6s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[    6s] 
[    6s] name = '/run/user', mode = 511, exist_ok = True
[    6s] 
[    6s]     def makedirs(name, mode=0o777, exist_ok=False):
[    6s]         """makedirs(name [, mode=0o777][, exist_ok=False])
[    6s]     
[    6s]         Super-mkdir; create a leaf directory and all intermediate ones.  Works like
[    6s]         mkdir, except that any intermediate path segment (not just the rightmost)
[    6s]         will be created if it does not exist. If the target directory already
[    6s]         exists, raise an OSError if exist_ok is False. Otherwise no exception is
[    6s]         raised.  This is recursive.
[    6s]     
[    6s]         """
[    6s]         head, tail = path.split(name)
[    6s]         if not tail:
[    6s]             head, tail = path.split(head)
[    6s]         if head and tail and not path.exists(head):
[    6s]             try:
[    6s]                 makedirs(head, exist_ok=exist_ok)
[    6s]             except FileExistsError:
[    6s]                 # Defeats race condition when another thread created the path
[    6s]                 pass
[    6s]             cdir = curdir
[    6s]             if isinstance(tail, bytes):
[    6s]                 cdir = bytes(curdir, 'ASCII')
[    6s]             if tail == cdir:           # xxx/newdir/. exists if xxx/newdir exists
[    6s]                 return
[    6s]         try:
[    6s] >           mkdir(name, mode)
[    6s] E           PermissionError: [Errno 13] Permission denied: '/run/user'
[    6s] 
[    6s] /usr/lib64/python3.10/os.py:225: PermissionError

Any idea how to fix it?

@alexandrevicenzi
Copy link

Adding something like the following to DummyVPNConnection might fix the issue.

def __base_path(self):
    return "/tmp/some/path/"

The problem is that OBS does not allow access to certain things outside the build directory, so a patch needs to be added to the package.

I did not test this, but I can test it later and submit an SR.

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

2 participants