Tests: Backport upstream unit tests fixes
After recent upstream rebase few tests were failing: * test_libc_futimes_works FAILED * test_exports_normal FAILED * test_exports_with_force_no_preserve_owner FAILED * test_fat FAILED Patches fixing those issues has been presented upstream shortly after rebasing has been completed. This commit adds backport those fixes. Resolves: RHEL-1770
This commit is contained in:
parent
8e509d09f6
commit
8b3600cefa
27
PR1539.patch
Normal file
27
PR1539.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From 01446c54110e929d5b1a315003cdcce5032a7427 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Vogt <michael.vogt@gmail.com>
|
||||||
|
Date: Wed, 17 Jan 2024 08:45:19 +0100
|
||||||
|
Subject: [PATCH] test: export schemas in testing_libdir_fixture
|
||||||
|
|
||||||
|
When constructing a minimal environment for osbuild the exported
|
||||||
|
dirs lacked "schemas" so the test_exports.py test failed on RHEL8.
|
||||||
|
|
||||||
|
This commit adds it (and also "assemblers" for good measure). With
|
||||||
|
that the test will pass.
|
||||||
|
---
|
||||||
|
test/run/test_exports.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/test/run/test_exports.py b/test/run/test_exports.py
|
||||||
|
index 12b4cfe73..d89096494 100644
|
||||||
|
--- a/test/run/test_exports.py
|
||||||
|
+++ b/test/run/test_exports.py
|
||||||
|
@@ -58,7 +58,7 @@ def testing_libdir_fixture(tmpdir_factory):
|
||||||
|
# in buildroot.py
|
||||||
|
(fake_libdir_path / "osbuild").mkdir()
|
||||||
|
# construct minimal viable libdir from current checkout
|
||||||
|
- for d in ["stages", "runners", ]:
|
||||||
|
+ for d in ["stages", "runners", "schemas", "assemblers"]:
|
||||||
|
subprocess.run(
|
||||||
|
["cp", "-a", os.fspath(project_path / d), f"{fake_libdir_path}"],
|
||||||
|
check=True)
|
24
PR1540.patch
Normal file
24
PR1540.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
From 49d9cc5897ec2b47ee5ef3254e5d93c7aecb3a52 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Vogt <michael.vogt@gmail.com>
|
||||||
|
Date: Wed, 17 Jan 2024 09:05:13 +0100
|
||||||
|
Subject: [PATCH] test: check that `mkfs.fat` has the `-g` option in `test_fat`
|
||||||
|
|
||||||
|
Older versions of RHEL/Centos do not have `mkfs.fat -g` yet so
|
||||||
|
this test will fail. Detect this and skip the test if mkfs.fat
|
||||||
|
is too old (see 7af2f1a for the original commit).
|
||||||
|
---
|
||||||
|
test/run/test_stages.py | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/test/run/test_stages.py b/test/run/test_stages.py
|
||||||
|
index bc6d8b31c..f6156369d 100644
|
||||||
|
--- a/test/run/test_stages.py
|
||||||
|
+++ b/test/run/test_stages.py
|
||||||
|
@@ -573,6 +573,7 @@ def test_btrfs(self):
|
||||||
|
assert "path home" in subvols[1]
|
||||||
|
|
||||||
|
@unittest.skipUnless(test.TestBase.has_filesystem_support("fat"), "FAT needed")
|
||||||
|
+ @unittest.skipUnless("-g GEOM" in subprocess.getoutput("mkfs.fat"), "mkfs.fat -g GEOM missing")
|
||||||
|
def test_fat(self):
|
||||||
|
def _get_file_fields(image: str) -> List[str]:
|
||||||
|
r = subprocess.run(
|
43
PR1541.patch
Normal file
43
PR1541.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From 0cdf98b1008161e5c07b9a4c578c7cecda4050ca Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Vogt <michael.vogt@gmail.com>
|
||||||
|
Date: Wed, 17 Jan 2024 09:29:26 +0100
|
||||||
|
Subject: [PATCH] test: fix `test_libc_futimes_works`
|
||||||
|
|
||||||
|
The test_libc_futimes_works() is failing under RHEL/Centos right
|
||||||
|
now. To make it more robust a tiny sleep and rounding of the
|
||||||
|
timestamps is introduced to ensure that we are not run into
|
||||||
|
floating point comaparison funnines.
|
||||||
|
|
||||||
|
The second part of the fix is to open the stamp_file in read-only
|
||||||
|
mode to ensure that the mtime is not modified by the open itself
|
||||||
|
which is what lead to the actual test failure.
|
||||||
|
---
|
||||||
|
test/mod/test_util_linux.py | 6 ++++--
|
||||||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/test/mod/test_util_linux.py b/test/mod/test_util_linux.py
|
||||||
|
index be31723d3..518a4bfa2 100644
|
||||||
|
--- a/test/mod/test_util_linux.py
|
||||||
|
+++ b/test/mod/test_util_linux.py
|
||||||
|
@@ -6,6 +6,7 @@
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
+import time
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
@@ -255,10 +256,11 @@ def test_libc_futimes_works(tmpdir):
|
||||||
|
with open(stamp_file, "wb") as fp:
|
||||||
|
fp.write(b"meep")
|
||||||
|
mtime1 = os.stat(stamp_file).st_mtime
|
||||||
|
- with open(stamp_file, "wb") as fp:
|
||||||
|
+ time.sleep(0.1)
|
||||||
|
+ with open(stamp_file, "rb") as fp:
|
||||||
|
libc.futimens(fp.fileno(), ctypes.byref(linux.c_timespec_times2(
|
||||||
|
atime=linux.c_timespec(tv_sec=3, tv_nsec=300 * 1000 * 1000),
|
||||||
|
mtime=linux.c_timespec(tv_sec=0, tv_nsec=libc.UTIME_OMIT),
|
||||||
|
)))
|
||||||
|
assert os.stat(stamp_file).st_atime == 3.3
|
||||||
|
- assert os.stat(stamp_file).st_mtime == mtime1
|
||||||
|
+ assert round(os.stat(stamp_file).st_mtime, 3) == round(mtime1, 3)
|
15
osbuild.spec
15
osbuild.spec
@ -9,12 +9,20 @@ Version: 104
|
|||||||
%global pkgdir %{_prefix}/lib/%{pypi_name}
|
%global pkgdir %{_prefix}/lib/%{pypi_name}
|
||||||
|
|
||||||
Name: %{pypi_name}
|
Name: %{pypi_name}
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: Apache-2.0
|
License: Apache-2.0
|
||||||
|
|
||||||
URL: %{forgeurl}
|
URL: %{forgeurl}
|
||||||
|
|
||||||
Source0: %{forgesource}
|
Source0: %{forgesource}
|
||||||
|
|
||||||
|
# https://github.com/osbuild/osbuild/pull/1539
|
||||||
|
Patch0: PR1539.patch
|
||||||
|
# https://github.com/osbuild/osbuild/pull/1540
|
||||||
|
Patch1: PR1540.patch
|
||||||
|
# https://github.com/osbuild/osbuild/pull/1541
|
||||||
|
Patch2: PR1541.patch
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
Summary: A build system for OS images
|
Summary: A build system for OS images
|
||||||
|
|
||||||
@ -278,13 +286,16 @@ fi
|
|||||||
%{_libexecdir}/osbuild-depsolve-dnf
|
%{_libexecdir}/osbuild-depsolve-dnf
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jan 17 2024 Paweł Poławski <ppolawsk@redhat.com> - 104-2
|
||||||
|
- Fix unit tests in RHEL CI by backporting upstream fixes
|
||||||
|
|
||||||
* Tue Jan 16 2024 imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> - 104-1
|
* Tue Jan 16 2024 imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> - 104-1
|
||||||
- New upstream release
|
- New upstream release
|
||||||
|
|
||||||
* Tue Dec 19 2023 imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> - 101-1
|
* Tue Dec 19 2023 imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> - 101-1
|
||||||
- New upstream release
|
- New upstream release
|
||||||
|
|
||||||
* Mon Dec 10 2023 Paweł Poławski <ppolawsk@redhat.com> - 100-2
|
* Mon Dec 11 2023 Paweł Poławski <ppolawsk@redhat.com> - 100-2
|
||||||
- Change unit-test timeout from 3h to 4h
|
- Change unit-test timeout from 3h to 4h
|
||||||
|
|
||||||
* Fri Nov 24 2023 imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> - 100-1
|
* Fri Nov 24 2023 imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> - 100-1
|
||||||
|
Loading…
Reference in New Issue
Block a user