Skip to content

Commit

Permalink
Add Fedora 41 among images we test against (#3172)
Browse files Browse the repository at this point in the history
  • Loading branch information
happz authored Aug 28, 2024
1 parent b9aa4a9 commit 3c4b0ea
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ TMT_TEST_CONTAINER_IMAGES := $(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/alpine:late
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/rawhide:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/rawhide/upstream:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/rawhide/unprivileged:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/41:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/41/upstream:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/41/unprivileged:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/40:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/40/upstream:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/40/unprivileged:latest \
Expand Down Expand Up @@ -157,6 +160,15 @@ $(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/r
$(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/rawhide/unprivileged\:latest:
$(call build-test-container-image,$@,fedora/rawhide/Containerfile.unprivileged)

$(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/41\:latest:
$(call build-test-container-image,$@,fedora/41/Containerfile)

$(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/41/upstream\:latest:
$(call build-test-container-image,$@,fedora/41/Containerfile.upstream)

$(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/41/unprivileged\:latest:
$(call build-test-container-image,$@,fedora/41/Containerfile.unprivileged)

$(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/40\:latest:
$(call build-test-container-image,$@,fedora/40/Containerfile)

Expand Down
13 changes: 13 additions & 0 deletions containers/fedora/41/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# A Fedora 41 image tailored for tmt test suite
#
# tmt/tests/fedora/41:latest
#

FROM quay.io/fedora/fedora:41

# Populate dnf cache
RUN dnf makecache \
# Inject `dnf5` to make things more complicated for `dnf` family of
# package manager implementations
&& dnf install -y dnf5
17 changes: 17 additions & 0 deletions containers/fedora/41/Containerfile.unprivileged
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# A Fedora 41 image tailored for tmt test suite, with unprivileged account & password-less sudo
#
# tmt/tests/fedora/41/unprivileged:latest
#

FROM quay.io/fedora/fedora:41

# Populate dnf cache
RUN dnf makecache \
# Create unprivileged user and setup sudo for it
&& dnf install -y /usr/sbin/useradd \
&& useradd fedora \
&& usermod -aG wheel fedora \
&& echo -e 'fedora\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers

USER fedora
10 changes: 10 additions & 0 deletions containers/fedora/41/Containerfile.upstream
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# A Fedora 41 image tailored for tmt test suite
#
# tmt/tests/fedora/41/upstream:latest
#

FROM quay.io/fedora/fedora:41

# Populate dnf cache
RUN dnf makecache
9 changes: 9 additions & 0 deletions tests/images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ $TEST_IMAGE_PREFIX/centos/7/upstream:latest
$TEST_IMAGE_PREFIX/centos/stream9/upstream:latest
$TEST_IMAGE_PREFIX/fedora/39/upstream:latest
$TEST_IMAGE_PREFIX/fedora/40/upstream:latest
$TEST_IMAGE_PREFIX/fedora/41/upstream:latest
$TEST_IMAGE_PREFIX/fedora/rawhide/upstream:latest
$TEST_IMAGE_PREFIX/fedora/coreos:stable
$TEST_IMAGE_PREFIX/fedora/coreos/ostree:stable
Expand All @@ -37,6 +38,7 @@ $TEST_IMAGE_PREFIX/ubuntu/22.04/upstream:latest}"
TEST_VIRTUAL_IMAGES="${TEST_VIRTUAL_IMAGES:-centos-stream-9
fedora-39
fedora-40
fedora-41
fedora-rawhide
fedora-coreos}"

Expand All @@ -48,6 +50,13 @@ function is_fedora_rawhide () {
return 1
}

function is_fedora_41 () {
[[ "$1" =~ ^.*fedora/41[:/].* ]] && return 0
[[ "$1" = "fedora-41" ]] && return 0

return 1
}

function is_fedora_40 () {
[[ "$1" =~ ^.*fedora/40[:/].* ]] && return 0
[[ "$1" = "fedora-40" ]] && return 0
Expand Down
10 changes: 10 additions & 0 deletions tests/prepare/install/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ rlJournalStart
rlRun "distro=fedora-rawhide"
rlRun "package_manager=dnf5"

elif is_fedora_41 "$image"; then
rlRun "distro=fedora-41"
rlRun "package_manager=dnf5"

elif is_fedora_40 "$image"; then
rlRun "distro=fedora-40"
rlRun "package_manager=dnf"
Expand Down Expand Up @@ -225,6 +229,9 @@ rlJournalStart
elif is_fedora_rawhide "$image"; then
rlAssertGrep "err: No match for argument: tree-but-spelled-wrong" $rlRun_LOG

elif is_fedora_41 "$image"; then
rlAssertGrep "err: No match for argument: tree-but-spelled-wrong" $rlRun_LOG

elif is_fedora_40 "$image"; then
rlAssertGrep "err: Error: Unable to find a match: tree-but-spelled-wrong" $rlRun_LOG

Expand Down Expand Up @@ -259,6 +266,9 @@ rlJournalStart
elif is_fedora_rawhide "$image"; then
rlAssertGrep "err: No match for argument: tree-but-spelled-wrong" $rlRun_LOG

elif is_fedora_41 "$image"; then
rlAssertGrep "err: No match for argument: tree-but-spelled-wrong" $rlRun_LOG

elif is_fedora_40 "$image"; then
rlAssertGrep "err: Error: Unable to find a match: tree-but-spelled-wrong" $rlRun_LOG

Expand Down
7 changes: 7 additions & 0 deletions tests/unit/test_package_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
# Local images created via `make images-tests`, reference to local registry
CONTAINER_FEDORA_RAWHIDE = Container(
url='containers-storage:localhost/tmt/tests/container/fedora/rawhide/upstream:latest')
CONTAINER_FEDORA_41 = Container(
url='containers-storage:localhost/tmt/tests/container/fedora/41/upstream:latest')
CONTAINER_FEDORA_40 = Container(
url='containers-storage:localhost/tmt/tests/container/fedora/40/upstream:latest')
CONTAINER_FEDORA_39 = Container(
Expand Down Expand Up @@ -82,6 +84,7 @@ def has_legacy_dnf(container: ContainerData) -> bool:

return container.image_url_or_id not in (
CONTAINER_FEDORA_RAWHIDE.url,
CONTAINER_FEDORA_41.url,
CONTAINER_FEDORA_COREOS.url,
CONTAINER_FEDORA_COREOS_OSTREE.url
)
Expand All @@ -92,6 +95,7 @@ def has_dnf5_preinstalled(container: ContainerData) -> bool:

return container.image_url_or_id in (
CONTAINER_FEDORA_RAWHIDE.url,
CONTAINER_FEDORA_41.url,
CONTAINER_FEDORA_COREOS.url,
CONTAINER_FEDORA_COREOS_OSTREE.url
)
Expand All @@ -106,6 +110,8 @@ def has_dnf5_preinstalled(container: ContainerData) -> bool:
# Fedora
(CONTAINER_FEDORA_RAWHIDE, PACKAGE_MANAGER_DNF5),

(CONTAINER_FEDORA_41, PACKAGE_MANAGER_DNF5),

(CONTAINER_FEDORA_40, PACKAGE_MANAGER_DNF5),
(CONTAINER_FEDORA_40, PACKAGE_MANAGER_DNF),
(CONTAINER_FEDORA_40, PACKAGE_MANAGER_YUM),
Expand Down Expand Up @@ -190,6 +196,7 @@ def fixture_guest_per_test(
def is_dnf5_preinstalled(container: ContainerData) -> bool:
return container.image_url_or_id in (
CONTAINER_FEDORA_RAWHIDE.url,
CONTAINER_FEDORA_41.url,
CONTAINER_FEDORA_COREOS.url,
CONTAINER_FEDORA_COREOS_OSTREE.url)

Expand Down

0 comments on commit 3c4b0ea

Please sign in to comment.