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

[Docker/Linux] test_disk_partitions failing inside Docker #1573

Closed
baldoalessandro opened this issue Aug 26, 2019 · 0 comments · Fixed by #1600
Closed

[Docker/Linux] test_disk_partitions failing inside Docker #1573

baldoalessandro opened this issue Aug 26, 2019 · 0 comments · Fixed by #1600
Assignees
Labels
docker enhancement linux tests vm any container (e.g. docker) or virtual OS (e.g. VMWare)

Comments

@baldoalessandro
Copy link

baldoalessandro commented Aug 26, 2019

If I run the tests suite inside a Docker container the TestSystemAPIs.test_disk_partitions fails.

======================================================================
FAIL: psutil.tests.test_system.TestSystemAPIs.test_disk_partitions
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/lib/python3.6/psutil/tests/test_system.py", line 508, in test_disk_partitions
    assert os.path.isdir(disk.mountpoint), disk
AssertionError: sdiskpart(device='/dev/sda5', mountpoint='/etc/resolv.conf', fstype='ext4', opts='rw,relatime,errors=remount-ro,data=ordered')

Of course psutil is woking fine and if I run in Python:

import psutil as pu	
pu.disk_partitions(all=False)
[
sdiskpart(device='/dev/sda5', mountpoint='/data', fstype='ext4', opts='rw,relatime,errors=remount-ro,data=ordered'),
sdiskpart(device='/dev/sda5', mountpoint='/etc/resolv.conf', fstype='ext4', opts='rw,relatime,errors=remount-ro,data=ordered'),
sdiskpart(device='/dev/sda5', mountpoint='/etc/hostname', fstype='ext4', opts='rw,relatime,errors=remount-ro,data=ordered'),
sdiskpart(device='/dev/sda5', mountpoint='/etc/hosts', fstype='ext4', opts='rw,relatime,errors=remount-ro,data=ordered')
]

it correctly finds all the partitions.

The test is checking if the mount-point is a directory but that is not the case inside a Docker container where /etc/resolv.conf is mounted from the host.

assert os.path.isdir(disk.mountpoint), disk

Is this something worth fixing?
Thank you for the project by the way 👍

xrmx added a commit to xrmx/psutil that referenced this issue Oct 8, 2019
As on at least Solaris and modern Linux systems they can be files too.
On linux bind mounts may commonly be used with containers.

Fix giampaolo#1573
xrmx added a commit to xrmx/psutil that referenced this issue Oct 8, 2019
As on at least Solaris and modern Linux systems they can be files too.
On linux bind mounts may commonly be used with containers.

Fix giampaolo#1573
giampaolo pushed a commit that referenced this issue Oct 8, 2019
As on at least Solaris and modern Linux systems they can be files too.
On linux bind mounts may commonly be used with containers.

Fix #1573
@giampaolo giampaolo added docker vm any container (e.g. docker) or virtual OS (e.g. VMWare) labels Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker enhancement linux tests vm any container (e.g. docker) or virtual OS (e.g. VMWare)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants