leapp-repository/SOURCES/0006-Update-our-test-container-to-Fedora-42.patch
2025-12-01 09:14:24 +00:00

133 lines
4.8 KiB
Diff

From 23d8f69509e692ceaa3dacc0de927349ec056189 Mon Sep 17 00:00:00 2001
From: Tomas Fratrik <tfratrik@redhat.com>
Date: Tue, 19 Aug 2025 09:19:18 +0200
Subject: [PATCH 06/55] Update our test container to Fedora 42
The distro.linux_distribution in createresumeservice test is replaced
distro.id(). The distro.linux_distribution has been deprecated and on
Fedora 42 containerized tests with python3.13 it doesn't work correctly
and the createresumeservice tests don't get skipped.
Jira: RHELMISC-13271
---
Makefile | 19 +++++++++----------
.../tests/test_createresumeservice.py | 2 +-
.../{Containerfile.f34 => Containerfile.f42} | 4 ++--
3 files changed, 12 insertions(+), 13 deletions(-)
rename utils/container-tests/{Containerfile.f34 => Containerfile.f42} (84%)
diff --git a/Makefile b/Makefile
index 81b16376..e0fc7e00 100644
--- a/Makefile
+++ b/Makefile
@@ -165,7 +165,7 @@ help:
@echo " MR=6 COPR_CONFIG='path/to/the/config/copr/file' make <target>"
@echo " ACTOR=<actor> TEST_LIBS=y make test"
@echo " BUILD_CONTAINER=rhel8 make build_container"
- @echo " TEST_CONTAINER=f34 make test_container"
+ @echo " TEST_CONTAINER=f42 make test_container"
@echo " CONTAINER_TOOL=docker TEST_CONTAINER=rhel8 make test_container_no_lint"
@echo ""
@@ -379,7 +379,6 @@ test_no_lint:
done; \
$(_PYTHON_VENV) -m pytest $(REPORT_ARG) $(TEST_PATHS) $(LIBRARY_PATH) $(PYTEST_ARGS)
-
test: lint test_no_lint
# container images act like a cache so that dependencies can only be downloaded once
@@ -416,7 +415,7 @@ lint_container:
@_TEST_CONT_TARGET="lint" $(MAKE) test_container
lint_container_all:
- @for container in "f34" "rhel8" "rhel9"; do \
+ @for container in "f42" "rhel8" "rhel9"; do \
TEST_CONTAINER=$$container $(MAKE) lint_container || exit 1; \
done
@@ -426,9 +425,9 @@ lint_container_all:
# because e.g RHEL8 to RHEL9 IPU must work on python3.6 and python3.9.
test_container:
@case $(_TEST_CONTAINER) in \
- f34) \
- export CONT_FILE="utils/container-tests/Containerfile.f34"; \
- export _VENV="python3.9"; \
+ f42) \
+ export CONT_FILE="utils/container-tests/Containerfile.f42"; \
+ export _VENV="python3.13"; \
;; \
rhel8) \
export CONT_FILE="utils/container-tests/Containerfile.rhel8"; \
@@ -439,7 +438,7 @@ test_container:
export _VENV="python3.9"; \
;; \
*) \
- echo "Error: Available containers are: f34, rhel8, rhel9"; exit 1; \
+ echo "Error: Available containers are: f42, rhel8, rhel9"; exit 1; \
;; \
esac; \
export TEST_IMAGE="leapp-repo-tests-$(_TEST_CONTAINER)"; \
@@ -471,7 +470,7 @@ test_container:
exit $$res
test_container_all:
- @for container in "f34" "rhel8" "rhel9"; do \
+ @for container in "f42" "rhel8" "rhel9"; do \
TEST_CONTAINER=$$container $(MAKE) test_container || exit 1; \
done
@@ -479,13 +478,13 @@ test_container_no_lint:
@_TEST_CONT_TARGET="test_no_lint" $(MAKE) test_container
test_container_all_no_lint:
- @for container in "f34" "rhel8" "rhel9"; do \
+ @for container in "f42" "rhel8" "rhel9"; do \
TEST_CONTAINER=$$container $(MAKE) test_container_no_lint || exit 1; \
done
# clean all testing and building containers and their images
clean_containers:
- @for i in "leapp-repo-tests-f34" "leapp-repo-tests-rhel8" \
+ @for i in "leapp-repo-tests-f42" "leapp-repo-tests-rhel8" \
"leapp-repo-tests-rhel9" "leapp-repo-build-el8"; do \
$(_CONTAINER_TOOL) kill "$$i-cont" || :; \
$(_CONTAINER_TOOL) rm "$$i-cont" || :; \
diff --git a/repos/system_upgrade/common/actors/createresumeservice/tests/test_createresumeservice.py b/repos/system_upgrade/common/actors/createresumeservice/tests/test_createresumeservice.py
index 5302cdd2..c1cefc37 100644
--- a/repos/system_upgrade/common/actors/createresumeservice/tests/test_createresumeservice.py
+++ b/repos/system_upgrade/common/actors/createresumeservice/tests/test_createresumeservice.py
@@ -6,7 +6,7 @@ import pytest
@pytest.mark.skipif(os.getuid() != 0, reason='User is not a root')
@pytest.mark.skipif(
- distro.linux_distribution()[0] == 'Fedora',
+ distro.id() == 'fedora',
reason='default.target.wants does not exists on Fedora distro',
)
def test_create_resume_service(current_actor_context):
diff --git a/utils/container-tests/Containerfile.f34 b/utils/container-tests/Containerfile.f42
similarity index 84%
rename from utils/container-tests/Containerfile.f34
rename to utils/container-tests/Containerfile.f42
index a9346635..46f0f63a 100644
--- a/utils/container-tests/Containerfile.f34
+++ b/utils/container-tests/Containerfile.f42
@@ -1,11 +1,11 @@
-FROM fedora:34
+FROM fedora:42
VOLUME /repo
RUN dnf update -y && \
dnf install -y findutils make rsync python3-gobject-base NetworkManager-libnm
-ENV PYTHON_VENV python3.9
+ENV PYTHON_VENV python3.13
COPY . /repocopy
--
2.51.1