Blame SOURCES/0006-Misc-test-fixes-backport.patch

a9076e
From 77b8d17b0baf96a7a552fb8963afdbe8c3b18da7 Mon Sep 17 00:00:00 2001
a9076e
From: Vojtech Trefny <vtrefny@redhat.com>
a9076e
Date: Wed, 2 Jun 2021 12:53:24 +0200
a9076e
Subject: [PATCH 1/4] tests: Make sure the test temp mount is always unmounted
a9076e
a9076e
With try-finally the unmount function will always run even if the
a9076e
test case fails.
a9076e
---
a9076e
 tests/fs_test.py | 6 ++++--
a9076e
 1 file changed, 4 insertions(+), 2 deletions(-)
a9076e
a9076e
diff --git a/tests/fs_test.py b/tests/fs_test.py
a9076e
index 2233db4f..de685b5f 100644
a9076e
--- a/tests/fs_test.py
a9076e
+++ b/tests/fs_test.py
a9076e
@@ -29,8 +29,10 @@ def check_output(args, ignore_retcode=True):
a9076e
 @contextmanager
a9076e
 def mounted(device, where, ro=False):
a9076e
     mount(device, where, ro)
a9076e
-    yield
a9076e
-    umount(where)
a9076e
+    try:
a9076e
+        yield
a9076e
+    finally:
a9076e
+        utils.umount(where)
a9076e
 
a9076e
 
a9076e
 def _get_dosfstools_version():
a9076e
a9076e
From aa802b6a2c9038069cfea7f821333367840a43ca Mon Sep 17 00:00:00 2001
a9076e
From: Vojtech Trefny <vtrefny@redhat.com>
a9076e
Date: Wed, 2 Jun 2021 13:05:17 +0200
a9076e
Subject: [PATCH 2/4] tests: Do not check that XFS shrink fails with xfsprogs
a9076e
 >= 5.12
a9076e
a9076e
xfsprogs 5.12 now has experimental support for shrinking, we need
a9076e
more changes to support it properly so just skip this check for
a9076e
now.
a9076e
---
a9076e
 tests/fs_test.py | 24 ++++++++++++++++++------
a9076e
 1 file changed, 18 insertions(+), 6 deletions(-)
a9076e
a9076e
diff --git a/tests/fs_test.py b/tests/fs_test.py
a9076e
index de685b5f..551b6a7b 100644
a9076e
--- a/tests/fs_test.py
a9076e
+++ b/tests/fs_test.py
a9076e
@@ -44,6 +44,14 @@ def _get_dosfstools_version():
a9076e
     return LooseVersion(m.groups()[0])
a9076e
 
a9076e
 
a9076e
+def _get_xfs_version():
a9076e
+    _ret, out, _err = utils.run_command("mkfs.xfs -V")
a9076e
+    m = re.search(r"mkfs\.xfs version ([\d\.]+)", out)
a9076e
+    if not m or len(m.groups()) != 1:
a9076e
+        raise RuntimeError("Failed to determine xfsprogs version from: %s" % out)
a9076e
+    return LooseVersion(m.groups()[0])
a9076e
+
a9076e
+
a9076e
 class FSTestCase(unittest.TestCase):
a9076e
 
a9076e
     requested_plugins = BlockDev.plugin_specs_from_names(("fs", "loop"))
a9076e
@@ -736,9 +744,11 @@ def test_xfs_resize(self):
a9076e
         self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2)
a9076e
 
a9076e
         # (still) impossible to shrink an XFS file system
a9076e
-        with mounted(lv, self.mount_dir):
a9076e
-            with self.assertRaises(GLib.GError):
a9076e
-                succ = BlockDev.fs_xfs_resize(self.mount_dir, 40 * 1024**2 / fi.block_size, None)
a9076e
+        xfs_version = _get_xfs_version()
a9076e
+        if xfs_version < LooseVersion("5.1.12"):
a9076e
+            with mounted(lv, self.mount_dir):
a9076e
+                with self.assertRaises(GLib.GError):
a9076e
+                    succ = BlockDev.fs_resize(lv, 40 * 1024**2)
a9076e
 
a9076e
         run("lvresize -L70M libbd_fs_tests/xfs_test >/dev/null 2>&1")
a9076e
         # should grow
a9076e
@@ -1503,9 +1513,11 @@ def test_xfs_generic_resize(self):
a9076e
         self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2)
a9076e
 
a9076e
         # (still) impossible to shrink an XFS file system
a9076e
-        with mounted(lv, self.mount_dir):
a9076e
-            with self.assertRaises(GLib.GError):
a9076e
-                succ = BlockDev.fs_resize(lv, 40 * 1024**2)
a9076e
+        xfs_version = _get_xfs_version()
a9076e
+        if xfs_version < LooseVersion("5.1.12"):
a9076e
+            with mounted(lv, self.mount_dir):
a9076e
+                with self.assertRaises(GLib.GError):
a9076e
+                    succ = BlockDev.fs_resize(lv, 40 * 1024**2)
a9076e
 
a9076e
         run("lvresize -L70M libbd_fs_tests/xfs_test >/dev/null 2>&1")
a9076e
         # should grow
a9076e
a9076e
From ca01b6021cce3ea6a2318e74de408757f933d947 Mon Sep 17 00:00:00 2001
a9076e
From: Vojtech Trefny <vtrefny@redhat.com>
a9076e
Date: Wed, 2 Jun 2021 13:06:41 +0200
a9076e
Subject: [PATCH 3/4] tests: Temporarily skip
a9076e
 test_snapshotcreate_lvorigin_snapshotmerge
a9076e
a9076e
With LVM DBus API the lvconvert job is never finished which means
a9076e
the test run never finishes in our CI.
a9076e
---
a9076e
 tests/skip.yml | 6 ++++++
a9076e
 1 file changed, 6 insertions(+)
a9076e
a9076e
diff --git a/tests/skip.yml b/tests/skip.yml
a9076e
index 145d321d..e22e712d 100644
a9076e
--- a/tests/skip.yml
a9076e
+++ b/tests/skip.yml
a9076e
@@ -137,3 +137,9 @@
a9076e
     - distro: "fedora"
a9076e
       version: ["31", "32"]
a9076e
       reason: "working with old-style LVM snapshots leads to deadlock in LVM tools"
a9076e
+
a9076e
+- test: lvm_dbus_tests.LvmTestLVsnapshots.test_snapshotcreate_lvorigin_snapshotmerge
a9076e
+  skip_on:
a9076e
+    - distro: "centos"
a9076e
+      version: "9"
a9076e
+      reason: "snapshot merge doesn't work on CentOS 9 Stream with LVM DBus API"
a9076e
a9076e
From d0c44cd3d182599433f352901796af7c403239eb Mon Sep 17 00:00:00 2001
a9076e
From: Vojtech Trefny <vtrefny@redhat.com>
a9076e
Date: Wed, 2 Jun 2021 13:08:09 +0200
a9076e
Subject: [PATCH 4/4] Fix skipping tests on Debian testing
a9076e
a9076e
Testing now identifies itself as "Debian GNU/Linux 11 (bullseye)"
a9076e
so the tests that should be skipped on testing needs to be skipped
a9076e
on "11" too.
a9076e
---
a9076e
 tests/skip.yml | 2 +-
a9076e
 1 file changed, 1 insertion(+), 1 deletion(-)
a9076e
a9076e
diff --git a/tests/skip.yml b/tests/skip.yml
a9076e
index e22e712d..4134ee87 100644
a9076e
--- a/tests/skip.yml
a9076e
+++ b/tests/skip.yml
a9076e
@@ -37,7 +37,7 @@
a9076e
 - test: fs_test.MountTest.test_mount_ntfs_ro
a9076e
   skip_on:
a9076e
     - distro: "debian"
a9076e
-      version: ["9", "10", "testing"]
a9076e
+      version: ["9", "10", "11", "testing"]
a9076e
       reason: "NTFS mounting of read-only devices doesn't work as expected on Debian"
a9076e
 
a9076e
 - test: kbd_test.KbdZRAM*