Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ 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/42:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/42/upstream:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/42/unprivileged:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/42/bootc:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/43:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/43/upstream:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/43/unprivileged:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/44:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/44/upstream:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/44/unprivileged:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/ubi/8/upstream:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/ubi/9/upstream:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/ubuntu/22.04/upstream:latest \
Expand Down Expand Up @@ -339,15 +339,6 @@ $(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/l
$(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/latest/unprivileged\:latest:
$(call build-test-container-image,$@,fedora/latest/Containerfile.unprivileged)

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

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

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

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

Expand Down
22 changes: 0 additions & 22 deletions containers/fedora/42/Containerfile

This file was deleted.

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

FROM quay.io/fedora/fedora:44

# hadolint ignore=DL3040
RUN <<EOF
set -ex

# Populate dnf cache
dnf makecache

# Make sure the image is built with the latest packages
dnf update -y
EOF
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#
# A Fedora 42 image tailored for tmt test suite, with unprivileged account & password-less sudo
# A Fedora 44 image tailored for tmt test suite, with unprivileged account & password-less sudo
#
# tmt/tests/fedora/42/unprivileged:latest
# tmt/tests/fedora/44/unprivileged:latest
#

FROM quay.io/fedora/fedora:42
FROM quay.io/fedora/fedora:44

# hadolint ignore=DL3040
RUN <<EOF
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#
# A Fedora 42 image tailored for tmt test suite
# A Fedora 44 image tailored for tmt test suite
#
# tmt/tests/fedora/42/upstream:latest
# tmt/tests/fedora/44/upstream:latest
#

FROM quay.io/fedora/fedora:42
FROM quay.io/fedora/fedora:44

RUN <<EOF
Comment thread
LecrisUT marked this conversation as resolved.
set -ex
Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions containers/fedora/rawhide/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,4 @@ dnf makecache

# Make sure the image is built with the latest packages
dnf update -y

# Inject `dnf5` to make things more complicated for `dnf` family of
# package manager implementations
dnf install -y dnf5
EOF
17 changes: 15 additions & 2 deletions tests/images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ TEST_CONTAINER_IMAGES="${TEST_CONTAINER_IMAGES:-$TEST_IMAGE_PREFIX/alpine:latest
$TEST_IMAGE_PREFIX/centos/7/upstream:latest
$TEST_IMAGE_PREFIX/centos/stream9/upstream:latest
$TEST_IMAGE_PREFIX/centos/stream10/upstream:latest
$TEST_IMAGE_PREFIX/fedora/42/upstream:latest
$TEST_IMAGE_PREFIX/fedora/43/upstream:latest
$TEST_IMAGE_PREFIX/fedora/44/upstream:latest
$TEST_IMAGE_PREFIX/fedora/rawhide/upstream:latest
$TEST_IMAGE_PREFIX/fedora/eln/upstream:latest
$TEST_IMAGE_PREFIX/ubi/8/upstream:latest
Expand All @@ -43,8 +43,8 @@ TEST_CONTAINER_IMAGES_SECONDARY="${TEST_CONTAINER_IMAGES_SECONDARY:-$TEST_IMAGE_
# TODO: enable centos-7 again with modified repo files
TEST_VIRTUAL_IMAGES="${TEST_VIRTUAL_IMAGES:-centos-stream-9
centos-stream-10
fedora-42
fedora-43
fedora-44
fedora-rawhide
fedora-coreos}"

Expand All @@ -69,6 +69,8 @@ TEST_IMAGE_MODE_IMAGES="${TEST_IMAGE_MODE_IMAGES:-$(printf "%s\n" "${!IMAGE_MODE
function is_fedora_rawhide () {
[[ "$1" =~ ^.*fedora/rawhide[:/].* ]] && return 0
[[ "$1" = "fedora-rawhide" ]] && return 0
[[ "$1" =~ ^.*fedora/45[:/].* ]] && return 0
[[ "$1" = "fedora-45" ]] && return 0

return 1
}
Expand All @@ -94,6 +96,17 @@ function is_fedora_43 () {
return 1
}

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

return 1
}

function is_fedora_45 () {
is_fedora_rawhide "$1"
}

Comment on lines +106 to +109
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a good idea, we will need to remember to update this after 45 branched?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the current state of how the branching is handled/not handled. This is purely an improvement over the status quo

function is_centos_stream_9 () {
[[ "$1" =~ ^.*centos/stream9[:/].* ]] && return 0
[[ "$1" = "centos-stream-9" ]] && return 0
Expand Down
162 changes: 37 additions & 125 deletions tests/prepare/install/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,36 @@ function fetch_downloaded_packages () {
fi
}

function assert_package_manager () {
rlAssertGrep "package manager: $package_manager$" $rlRun_LOG

if is_centos_7 "$image"; then
rlAssertGrep "stdout: no package provides tree-but-spelled-wrong" $rlRun_LOG

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

elif is_ostree "$image"; then
if [ "$PROVISION_HOW" = "virtual" ]; then
rlAssertGrep "stderr: No match for argument: tree-but-spelled-wrong" $rlRun_LOG
else
rlAssertGrep "stderr: error: Packages not found: tree-but-spelled-wrong" $rlRun_LOG
fi

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

elif is_ubuntu "$image" || is_debian "$image"; then
rlAssertGrep "stderr: E: Unable to locate package tree-but-spelled-wrong" $rlRun_LOG

elif is_alpine "$image"; then
rlAssertGrep "stderr: tree-but-spelled-wrong (no such package)" $rlRun_LOG

else
rlAssertGrep "stderr: Error: Unable to find a match: tree-but-spelled-wrong" $rlRun_LOG
fi
}

rlJournalStart
rlPhaseStartSetup
rlRun "PROVISION_HOW=${PROVISION_HOW:-container}"
Expand Down Expand Up @@ -89,6 +119,10 @@ rlJournalStart
rlRun "distro=fedora-43"
rlRun "package_manager=dnf5"

elif is_fedora_44 "$image"; then
rlRun "distro=fedora-44"
rlRun "package_manager=dnf5"

elif is_centos_stream_9 "$image"; then
rlRun "distro=centos-stream-9"
rlRun "package_manager=dnf"
Expand Down Expand Up @@ -288,143 +322,21 @@ rlJournalStart

rlPhaseStartTest "$phase_prefix Install existing and invalid packages (plan)"
rlRun -s "$tmt plan --name /missing" 2

rlAssertGrep "package manager: $package_manager$" $rlRun_LOG

if is_centos_7 "$image"; then
rlAssertGrep "stdout: no package provides tree-but-spelled-wrong" $rlRun_LOG

elif is_image_mode "$image"; then
if is_fedora "$image"; then
rlAssertGrep "stderr: No match for argument: tree-but-spelled-wrong" $rlRun_LOG
else
rlAssertGrep "stderr: Error: Unable to find a match: tree-but-spelled-wrong" $rlRun_LOG
fi

elif is_ostree "$image"; then
if [ "$PROVISION_HOW" = "virtual" ]; then
rlAssertGrep "stderr: No match for argument: tree-but-spelled-wrong" $rlRun_LOG
else
rlAssertGrep "stderr: error: Packages not found: tree-but-spelled-wrong" $rlRun_LOG
fi

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

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

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

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

elif is_ubuntu "$image" || is_debian "$image"; then
rlAssertGrep "stderr: E: Unable to locate package tree-but-spelled-wrong" $rlRun_LOG

elif is_alpine "$image"; then
rlAssertGrep "stderr: tree-but-spelled-wrong (no such package)" $rlRun_LOG

else
rlAssertGrep "stderr: Error: Unable to find a match: tree-but-spelled-wrong" $rlRun_LOG
fi

assert_package_manager
rlAssertGrep "Other failed packages:" $rlRun_LOG
rlAssertGrep "tree-but-spelled-wrong" $rlRun_LOG
rlPhaseEnd

rlPhaseStartTest "$phase_prefix Install existing and invalid packages (test)"
rlRun -s "$tmt plan --name /missing-from-test" 2

rlAssertGrep "package manager: $package_manager$" $rlRun_LOG

if is_centos_7 "$image"; then
rlAssertGrep "stdout: no package provides tree-but-spelled-wrong" $rlRun_LOG

elif is_image_mode "$image"; then
if is_fedora "$image"; then
rlAssertGrep "stderr: No match for argument: tree-but-spelled-wrong" $rlRun_LOG
else
rlAssertGrep "stderr: Error: Unable to find a match: tree-but-spelled-wrong" $rlRun_LOG
fi

elif is_ostree "$image"; then
if [ "$PROVISION_HOW" = "virtual" ]; then
rlAssertGrep "stderr: No match for argument: tree-but-spelled-wrong" $rlRun_LOG
else
rlAssertGrep "stderr: error: Packages not found: tree-but-spelled-wrong" $rlRun_LOG
fi

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

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

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

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

elif is_ubuntu "$image" || is_debian "$image"; then
rlAssertGrep "stderr: E: Unable to locate package tree-but-spelled-wrong" $rlRun_LOG

elif is_alpine "$image"; then
rlAssertGrep "stderr: tree-but-spelled-wrong (no such package)" $rlRun_LOG

else
rlAssertGrep "stderr: Error: Unable to find a match: tree-but-spelled-wrong" $rlRun_LOG
fi

assert_package_manager
rlAssertGrep "Required packages failed to install, aborting:" $rlRun_LOG
rlAssertGrep "tree-but-spelled-wrong: required by: /test-with-invalid-package" $rlRun_LOG
rlPhaseEnd

rlPhaseStartTest "$phase_prefix Install existing and invalid packages (CLI)"
rlRun -s "$tmt --insert --how install --package tree-but-spelled-wrong --package diffutils plan --name /empty" 2

rlAssertGrep "package manager: $package_manager$" $rlRun_LOG

if is_centos_7 "$image"; then
rlAssertGrep "stdout: no package provides tree-but-spelled-wrong" $rlRun_LOG

elif is_image_mode "$image"; then
if is_fedora "$image"; then
rlAssertGrep "stderr: No match for argument: tree-but-spelled-wrong" $rlRun_LOG
else
rlAssertGrep "stderr: Error: Unable to find a match: tree-but-spelled-wrong" $rlRun_LOG
fi

elif is_ostree "$image"; then
if [ "$PROVISION_HOW" = "virtual" ]; then
rlAssertGrep "stderr: No match for argument: tree-but-spelled-wrong" $rlRun_LOG
else
rlAssertGrep "stderr: error: Packages not found: tree-but-spelled-wrong" $rlRun_LOG
fi

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

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

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

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

elif is_ubuntu "$image" || is_debian "$image"; then
rlAssertGrep "stderr: E: Unable to locate package tree-but-spelled-wrong" $rlRun_LOG

elif is_alpine "$image"; then
rlAssertGrep "stderr: tree-but-spelled-wrong (no such package)" $rlRun_LOG

else
rlAssertGrep "stderr: Error: Unable to find a match: tree-but-spelled-wrong" $rlRun_LOG
fi
assert_package_manager
rlAssertGrep "Other failed packages:" $rlRun_LOG
rlAssertGrep "tree-but-spelled-wrong" $rlRun_LOG
rlPhaseEnd
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ def assert_not_log(
CONTAINER_FEDORA_RAWHIDE = Container(
url='containers-storage:localhost/tmt/container/test/fedora/rawhide/upstream:latest'
)
CONTAINER_FEDORA_44 = Container(
url='containers-storage:localhost/tmt/container/test/fedora/44/upstream:latest'
)
CONTAINER_FEDORA_43 = Container(
url='containers-storage:localhost/tmt/container/test/fedora/43/upstream:latest'
)
CONTAINER_FEDORA_42 = Container(
url='containers-storage:localhost/tmt/container/test/fedora/42/upstream:latest'
)
CONTAINER_FEDORA_ELN = Container(
url='containers-storage:localhost/tmt/container/test/fedora/eln/upstream:latest'
)
Expand Down
Loading
Loading