Package: nvme-stas Followup-For: Bug #1054533 User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu noble ubuntu-patch Control: tags -1 patch
Dear Maintainer, Several test cases in nvme-stas 2.3-1 were making the autopkgtest fail. In Ubuntu, the attached patch was applied to achieve the following: * Add Test-Depends on nvme-cli to fix the absence of /etc/nvme/host{nqn,id} when running the test suite. (LP: #2043792) - This is only a workaround for autopkgtests. stafd can still fail with the same error at runtime outside of autopkgtests when configured with an appropriate "controller =" directive. * Fix failing test from mocked libnvme version. (LP: #2043792) * Fix legacy Udev test failing when multiples IPv6 addresses are set. (LP: #2043792) Thanks for considering the patch. -- System Information: Debian Release: trixie/sid APT prefers mantic-updates APT policy: (500, 'mantic-updates'), (500, 'mantic-security'), (500, 'mantic') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 6.1.0-16-generic (SMP w/8 CPU threads; PREEMPT) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled
diff -Nru nvme-stas-2.3/debian/patches/fix-test-libnvme-version.patch nvme-stas-2.3/debian/patches/fix-test-libnvme-version.patch --- nvme-stas-2.3/debian/patches/fix-test-libnvme-version.patch 1970-01-01 01:00:00.000000000 +0100 +++ nvme-stas-2.3/debian/patches/fix-test-libnvme-version.patch 2023-11-21 09:29:41.000000000 +0100 @@ -0,0 +1,52 @@ +Description: Fix mock libnvme test so it works in GitHub actions & autopkgtest + Different Python test frameworks manage Python processes differently + when running tests. When running `python3 -m unittest` for instance, it + looks like the same process executes all the tests. Therefore when one + test module T1 imports a module, the module is not re-imported if needed + by T2. + . + This causes issues with test-defs.py which tries to mock the libnvme + module. Indeed, when it is previously imported by staslib, the mocked + libnvme module does not get re-imported. + . + Fixed by removing staslib and staslib.defs from the imported modules + before executing the test. +Author: Olivier Gayot <olivier.ga...@canonical.com> +Origin: upstream, https://github.com/linux-nvme/nvme-stas/commit/2efebdb4dec6d5a6341a577273a1ce7b57fe488c +Bug-Ubuntu: https://launchpad.net/bugs/2043792 +Bug-Debian: https://bugs.debian.org/1054533 +Last-Update: 2023-11-27 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/test/test-defs.py ++++ b/test/test-defs.py +@@ -1,4 +1,5 @@ + #!/usr/bin/python3 ++import contextlib + import os + import sys + import unittest +@@ -9,13 +10,17 @@ + '''Testing defs.py by mocking the libnvme package''' + + def test_libnvme_version(self): +- # For unknown reasons, this test does +- # not work when run from GitHub Actions. +- if not os.getenv('GITHUB_ACTIONS'): +- from staslib import defs ++ # Ensure that we re-import staslib & staslib.defs if the current Python ++ # process has them already imported. ++ with contextlib.suppress(KeyError): ++ sys.modules.pop('staslib.defs') ++ with contextlib.suppress(KeyError): ++ sys.modules.pop('staslib') + +- libnvme_ver = defs.LIBNVME_VERSION +- self.assertEqual(libnvme_ver, '?.?') ++ from staslib import defs ++ ++ libnvme_ver = defs.LIBNVME_VERSION ++ self.assertEqual(libnvme_ver, '?.?') + + @classmethod + def setUpClass(cls): # called once before all the tests diff -Nru nvme-stas-2.3/debian/patches/fix-test-udev-failing-multiple-IPv6.patch nvme-stas-2.3/debian/patches/fix-test-udev-failing-multiple-IPv6.patch --- nvme-stas-2.3/debian/patches/fix-test-udev-failing-multiple-IPv6.patch 1970-01-01 01:00:00.000000000 +0100 +++ nvme-stas-2.3/debian/patches/fix-test-udev-failing-multiple-IPv6.patch 2023-11-21 09:29:41.000000000 +0100 @@ -0,0 +1,29 @@ +Description: Fix test-udev failing when multiple IPv6 addresses are used + test-udev was failing when an interface had more than one IPv6 + addresses assigned. This was due to the test checking that the + number of assigned IPv6 addresses was exactly 1 (== 1) instead of + checking greater-equal to 1 (>= 1). +Author: Martin Belanger <martin.belan...@dell.com> +Origin: upstream, https://github.com/linux-nvme/nvme-stas/commit/66b42bdd83bb6a83b30da3aed5fea9ed4da882f6 +Bug: https://github.com/linux-nvme/nvme-stas/issues/403 +Bug-Ubuntu: https://launchpad.net/bugs/2043792 +Bug-Debian: https://bugs.debian.org/1054533 +Last-Update: 2023-11-27 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +diff --git a/test/test-udev.py b/test/test-udev.py +index be257d9..ba484e0 100755 +--- a/test/test-udev.py ++++ b/test/test-udev.py +@@ -679,7 +679,7 @@ class Test(unittest.TestCase): + 'host-nqn': '', + } + ) +- match = len(ipv6_addrs) == 1 and iputil.get_ipaddress_obj( ++ match = len(ipv6_addrs) >= 1 and iputil.get_ipaddress_obj( + ipv6_addrs[0], ipv4_mapped_convert=True + ) == iputil.get_ipaddress_obj(tid.host_traddr, ipv4_mapped_convert=True) + self.assertEqual( +-- +2.40.1 + diff -Nru nvme-stas-2.3/debian/patches/series nvme-stas-2.3/debian/patches/series --- nvme-stas-2.3/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 +++ nvme-stas-2.3/debian/patches/series 2023-11-21 09:29:41.000000000 +0100 @@ -0,0 +1,2 @@ +fix-test-libnvme-version.patch +fix-test-udev-failing-multiple-IPv6.patch diff -Nru nvme-stas-2.3/debian/tests/control nvme-stas-2.3/debian/tests/control --- nvme-stas-2.3/debian/tests/control 2023-09-25 10:22:09.000000000 +0200 +++ nvme-stas-2.3/debian/tests/control 2023-11-21 09:29:41.000000000 +0100 @@ -1,6 +1,7 @@ Test-Command: cp -r test "$AUTOPKGTEST_TMP" && cd "$AUTOPKGTEST_TMP/test" && rm test-avahi.py && python3 -m unittest -v test*.py Depends: iproute2, + nvme-cli, # Dependency added to get the /etc/nvme/host{nqn,id} files created. See LP: #2043792 nvme-stas, python3-pyfakefs, Restrictions: allow-stderr