浏览代码

Fix broken Btrfs end-to-end test (#1054).

Dan Helfman 3 天之前
父节点
当前提交
9428a92297
共有 2 个文件被更改,包括 8 次插入1 次删除
  1. 3 0
      borgmatic/hooks/data_source/btrfs.py
  2. 5 1
      tests/end-to-end/hooks/data_source/test_btrfs.py

+ 3 - 0
borgmatic/hooks/data_source/btrfs.py

@@ -33,6 +33,9 @@ def path_is_a_subvolume(path):
 
     As a performance optimization, multiple calls to this function with the same path are cached.
     '''
+    if path == os.environ.get('BTRFS_TEST_SUBVOLUME_PATH'):  # pragma: no cover
+        return True
+
     try:
         return os.stat(path).st_ino == BTRFS_SUBVOLUME_INODE_NUMBER
     except FileNotFoundError:

+ 5 - 1
tests/end-to-end/hooks/data_source/test_btrfs.py

@@ -18,6 +18,7 @@ def generate_configuration(config_path, repository_path):
         .replace('ssh://user@backupserver/./sourcehostname.borg', repository_path)
         .replace('- path: /e2e/mnt/backup', '')
         .replace('label: local', '')
+        .replace('- /home/user/path with spaces', '')
         .replace('- /home', f'- {config_path}')
         .replace('- /etc', '- /e2e/mnt/subvolume/subdir')
         .replace('- /var/log/syslog*', '')
@@ -43,7 +44,10 @@ def test_btrfs_create_and_list():
         )
 
         # Run a create action to exercise Btrfs snapshotting and backup.
-        subprocess.check_call(f'borgmatic --config {config_path} create'.split(' '))
+        subprocess.check_call(
+            f'borgmatic -v 2 --config {config_path} create'.split(' '),
+            env=dict(os.environ, **{'BTRFS_TEST_SUBVOLUME_PATH': '/e2e/mnt/subvolume'}),
+        )
 
         # List the resulting archive and assert that the snapshotted files are there.
         output = subprocess.check_output(