Blob Blame History Raw
From 77b8d17b0baf96a7a552fb8963afdbe8c3b18da7 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 2 Jun 2021 12:53:24 +0200
Subject: [PATCH 1/4] tests: Make sure the test temp mount is always unmounted

With try-finally the unmount function will always run even if the
test case fails.
---
 tests/fs_test.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/fs_test.py b/tests/fs_test.py
index 2233db4f..de685b5f 100644
--- a/tests/fs_test.py
+++ b/tests/fs_test.py
@@ -29,8 +29,10 @@ def check_output(args, ignore_retcode=True):
 @contextmanager
 def mounted(device, where, ro=False):
     mount(device, where, ro)
-    yield
-    umount(where)
+    try:
+        yield
+    finally:
+        utils.umount(where)
 
 
 def _get_dosfstools_version():

From aa802b6a2c9038069cfea7f821333367840a43ca Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 2 Jun 2021 13:05:17 +0200
Subject: [PATCH 2/4] tests: Do not check that XFS shrink fails with xfsprogs
 >= 5.12

xfsprogs 5.12 now has experimental support for shrinking, we need
more changes to support it properly so just skip this check for
now.
---
 tests/fs_test.py | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/tests/fs_test.py b/tests/fs_test.py
index de685b5f..551b6a7b 100644
--- a/tests/fs_test.py
+++ b/tests/fs_test.py
@@ -44,6 +44,14 @@ def _get_dosfstools_version():
     return LooseVersion(m.groups()[0])
 
 
+def _get_xfs_version():
+    _ret, out, _err = utils.run_command("mkfs.xfs -V")
+    m = re.search(r"mkfs\.xfs version ([\d\.]+)", out)
+    if not m or len(m.groups()) != 1:
+        raise RuntimeError("Failed to determine xfsprogs version from: %s" % out)
+    return LooseVersion(m.groups()[0])
+
+
 class FSTestCase(unittest.TestCase):
 
     requested_plugins = BlockDev.plugin_specs_from_names(("fs", "loop"))
@@ -736,9 +744,11 @@ def test_xfs_resize(self):
         self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2)
 
         # (still) impossible to shrink an XFS file system
-        with mounted(lv, self.mount_dir):
-            with self.assertRaises(GLib.GError):
-                succ = BlockDev.fs_xfs_resize(self.mount_dir, 40 * 1024**2 / fi.block_size, None)
+        xfs_version = _get_xfs_version()
+        if xfs_version < LooseVersion("5.1.12"):
+            with mounted(lv, self.mount_dir):
+                with self.assertRaises(GLib.GError):
+                    succ = BlockDev.fs_resize(lv, 40 * 1024**2)
 
         run("lvresize -L70M libbd_fs_tests/xfs_test >/dev/null 2>&1")
         # should grow
@@ -1503,9 +1513,11 @@ def test_xfs_generic_resize(self):
         self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2)
 
         # (still) impossible to shrink an XFS file system
-        with mounted(lv, self.mount_dir):
-            with self.assertRaises(GLib.GError):
-                succ = BlockDev.fs_resize(lv, 40 * 1024**2)
+        xfs_version = _get_xfs_version()
+        if xfs_version < LooseVersion("5.1.12"):
+            with mounted(lv, self.mount_dir):
+                with self.assertRaises(GLib.GError):
+                    succ = BlockDev.fs_resize(lv, 40 * 1024**2)
 
         run("lvresize -L70M libbd_fs_tests/xfs_test >/dev/null 2>&1")
         # should grow

From ca01b6021cce3ea6a2318e74de408757f933d947 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 2 Jun 2021 13:06:41 +0200
Subject: [PATCH 3/4] tests: Temporarily skip
 test_snapshotcreate_lvorigin_snapshotmerge

With LVM DBus API the lvconvert job is never finished which means
the test run never finishes in our CI.
---
 tests/skip.yml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/skip.yml b/tests/skip.yml
index 145d321d..e22e712d 100644
--- a/tests/skip.yml
+++ b/tests/skip.yml
@@ -137,3 +137,9 @@
     - distro: "fedora"
       version: ["31", "32"]
       reason: "working with old-style LVM snapshots leads to deadlock in LVM tools"
+
+- test: lvm_dbus_tests.LvmTestLVsnapshots.test_snapshotcreate_lvorigin_snapshotmerge
+  skip_on:
+    - distro: "centos"
+      version: "9"
+      reason: "snapshot merge doesn't work on CentOS 9 Stream with LVM DBus API"

From d0c44cd3d182599433f352901796af7c403239eb Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 2 Jun 2021 13:08:09 +0200
Subject: [PATCH 4/4] Fix skipping tests on Debian testing

Testing now identifies itself as "Debian GNU/Linux 11 (bullseye)"
so the tests that should be skipped on testing needs to be skipped
on "11" too.
---
 tests/skip.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/skip.yml b/tests/skip.yml
index e22e712d..4134ee87 100644
--- a/tests/skip.yml
+++ b/tests/skip.yml
@@ -37,7 +37,7 @@
 - test: fs_test.MountTest.test_mount_ntfs_ro
   skip_on:
     - distro: "debian"
-      version: ["9", "10", "testing"]
+      version: ["9", "10", "11", "testing"]
       reason: "NTFS mounting of read-only devices doesn't work as expected on Debian"
 
 - test: kbd_test.KbdZRAM*