Skip to content

Commit e6cfc87

Browse files
CopilotMaxG87
andauthored
fix: look up mount point by directory content, not by device path
Agent-Logs-Url: https://github.com/MaxG87/ButterBackup/sessions/4b40e0ca-a4f5-4bc1-a0be-678d60d13fbf Co-authored-by: MaxG87 <5477952+MaxG87@users.noreply.github.com>
1 parent d9a8050 commit e6cfc87

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tests/test_cli.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,15 @@ def test_unmount_error_does_not_cause_content_deletion(
451451
# It is assumed that the device is still mounted, since the unmounting is mocked to
452452
# fail.
453453
mounts = sdm.get_mounted_devices()
454-
mount_of_device = next(iter(mounts[str(config.map_name())]))
454+
# In some environments (e.g. Docker) the device mapper node appears as /dev/dm-X in
455+
# the mount table rather than /dev/mapper/{UUID}. Search all mount points for the
456+
# one containing BackupRepositoryFolder instead of looking up by device path.
457+
mount_of_device = next(
458+
mount_point
459+
for mount_points in mounts.values()
460+
for mount_point in mount_points
461+
if (mount_point / config.BackupRepositoryFolder).exists()
462+
)
455463
expected_backup_repository = mount_of_device / config.BackupRepositoryFolder
456464
assert expected_backup_repository.exists()
457465
assert expected_backup_repository.is_dir()

0 commit comments

Comments
 (0)