Skip to content

Commit d55600f

Browse files
committed
address comments from code review
1 parent 209be30 commit d55600f

16 files changed

Lines changed: 84 additions & 91 deletions

File tree

‎tests/prepare/artifact/lib/common.sh‎

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,41 @@
33

44
# Setup distro test environment
55
#
6-
# This function checks the distro, sets up the release version
7-
# and image_name variables, and builds the container image.
6+
# This function checks the distro, sets up the release version,
7+
# image_name, and koji_tag variables, and builds the container image.
88
#
99
# Sets the following global variables:
10-
# fedora_release - The Fedora release version (e.g., "43")
10+
# release - The distro release version (e.g., "43" for Fedora, "10" for CentOS)
1111
# image_name - The container image name (e.g., "fedora/43:latest")
12+
# koji_tag - The koji tag for querying builds (e.g., "f43" for Fedora, "epel10" for CentOS)
1213
#
1314
# Usage: setup_distro_environment
1415
#
1516
setup_distro_environment() {
16-
if ! rlIsFedora; then
17-
rlDie "Test requires Fedora"
17+
if rlIsFedora; then
18+
release=$(rlGetDistroRelease)
19+
koji_tag="f${release}"
20+
distro="fedora-${release}"
21+
# FIXME: Rawhide reports numeric release identifiers (e.g., "45") but versioned
22+
# container targets (fedora/45/*) don't exist yet. Mapping fedora/45 to rawhide
23+
# as a workaround until https://github.com/teemtee/tmt/pull/4775 is merged.
24+
if grep -qi "rawhide" /etc/os-release; then
25+
image_name="fedora/rawhide:latest"
26+
else
27+
image_name="fedora/${release}:latest"
28+
fi
29+
elif rlIsCentOS; then
30+
release=$(rlGetDistroRelease)
31+
image_name="centos/stream${release}/upstream:latest"
32+
koji_tag="epel${release}"
33+
distro="centos-stream-${release}"
34+
else
35+
rlDie "Test requires Fedora or CentOS"
1836
fi
19-
20-
# TODO: Temporary hardcoded release - should be taken from function input
21-
fedora_release=43
22-
image_name="fedora/${fedora_release}:latest"
2337
build_container_image "$image_name"
2438
}
2539

26-
# Setup CentOS test environment
27-
#
28-
# Sets the following global variables:
29-
# centos_release - The CentOS Stream release version (e.g., "10")
30-
# epel_tag - The EPEL koji tag (e.g., "epel10.3" or "epel9")
31-
# image_name - The container image name (e.g., "centos/stream10/upstream:latest")
32-
#
33-
# Usage: setup_centos_environment
34-
#
35-
setup_centos_environment() {
36-
if ! rlIsCentOS; then
37-
rlDie "Test requires CentOS"
38-
fi
39-
40-
centos_release=$(rlGetDistroRelease)
41-
image_name="centos/stream${centos_release}/upstream:latest"
42-
build_container_image "$image_name"
43-
44-
# For CentOS 10+, packages are tagged under epelX.Y (e.g., epel10.3).
45-
# For CentOS 9 and earlier, the plain epelX tag is used (e.g., epel9).
46-
epel_tag=$(koji list-tags 2>/dev/null | grep -E "^epel${centos_release}\.[0-9]+$" | sort -V | tail -1)
47-
epel_tag="${epel_tag:-epel${centos_release}}"
48-
}
49-
50-
# Get koji build ID from package name (fetch latest for tag)
40+
# Get koji build ID from package name (fetch latest for tag, with inheritance)
5141
#
5242
# Usage:
5343
# get_koji_build_id "make" "f43"
@@ -66,14 +56,17 @@ setup_centos_environment() {
6656
# in the KOJI_BUILD_ID global variable (not printed to stdout) to
6757
# avoid capturing rlRun output when using command substitution.
6858
#
59+
# The --inherit flag is used to also search parent tags (e.g., epel10.3
60+
# inherits from epel10), ensuring builds inherited from parent tags are found.
61+
#
6962
get_koji_build_id() {
7063
local package="$1"
7164
local tag="$2"
7265
unset KOJI_BUILD_ID # Clear any previous value
7366

74-
# Get the latest tagged build for the package
67+
# Get the latest tagged build for the package (including inherited tags)
7568
# Output format: "make-4.4.1-10.fc42 f42 releng"
76-
rlRun -s "koji list-tagged --latest $tag $package" 0 "Get the latest $package build"
69+
rlRun -s "koji list-tagged --latest --inherit $tag $package" 0 "Get the latest $package build (with inheritance)"
7770

7871
# The NVR should be the first word in the last line
7972
if [[ ! "$(tail -1 $rlRun_LOG)" =~ ^([^[:space:]]+) ]]; then

‎tests/prepare/artifact/main.fmf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ adjust:
1313
- when: distro != fedora
1414
enabled: false
1515
because: Need to dynamically handle centos/brew/epel artifacts somehow also
16+
# FIXME: docker-ce.repo does not support Fedora 44+, pick a stable
17+
# repository-file source available on all Fedora releases and remove this gate.
18+
- when: distro ~> fedora-43
19+
enabled: false
20+
because: docker-ce.repo does not support Fedora 44+

‎tests/prepare/artifact/providers/copr-repository/main.fmf‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@ summary: Test copr-repository artifact provider
22
description: |
33
Test copr-repository artifact provider which makes packages from Copr
44
repositories available for installation.
5+
6+
# FIXME: mariobl/pyspread only has chroots for Fedora 43+. Replace with a
7+
# tmt-owned COPR project with auto-branching so the gate can be removed.
8+
# See https://github.com/teemtee/tmt/issues/4776
9+
adjust+:
10+
- when: distro ~< fedora-43
11+
enabled: false
12+
because: mariobl/pyspread COPR only has chroots for Fedora 43+

‎tests/prepare/artifact/providers/file/test.sh‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rlJournalStart
1717
setup_distro_environment
1818

1919
# 1. REMOTE URL (noarch)
20-
get_koji_nvr "cowsay" "f${fedora_release}"
20+
get_koji_nvr "cowsay" "$koji_tag"
2121
COWSAY_NVR="$KOJI_NVR"
2222

2323
# Construct URL: Parses NVR (Name-Version-Release) and assembles Koji URL
@@ -27,16 +27,16 @@ rlJournalStart
2727
rlLog "Using cowsay URL: $REMOTE_RPM_URL"
2828

2929
# 2. LOCAL FILE (arch-specific)
30-
get_koji_nvr "figlet" "f${fedora_release}"
30+
get_koji_nvr "figlet" "$koji_tag"
3131
FIGLET_NVR="$KOJI_NVR"
3232

3333
rlRun "pushd $rpm_dir && koji download-build --arch=$ARCH $FIGLET_NVR; popd" 0 "Download figlet RPM for local test"
3434
LOCAL_RPM=$(ls $rpm_dir/figlet*.rpm)
3535
rlAssertExists "$LOCAL_RPM"
3636

3737
rlRun "multi_rpm_dir=$(mktemp -d)" 0 "Create directory for multiple RPMs"
38-
# Use $fedora_release (set by setup_distro_environment) to ensure packages
39-
rlRun "dnf download --forcearch=$ARCH --releasever=$fedora_release --destdir=$multi_rpm_dir boxes fortune-mod" 0 "Download boxes and fortune-mod RPMs using dnf"
38+
# Use $release (set by setup_distro_environment) to ensure packages
39+
rlRun "dnf download --forcearch=$ARCH --releasever=$release --destdir=$multi_rpm_dir boxes fortune-mod" 0 "Download boxes and fortune-mod RPMs using dnf"
4040
rlPhaseEnd
4141

4242
rlPhaseStartTest "Test file provider with remote URL, local RPM, and directory with multiple RPMs"

‎tests/prepare/artifact/providers/koji-build/test.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rlJournalStart
1313
setup_distro_environment
1414

1515
# Get koji build ID for make
16-
get_koji_build_id "make" "f${fedora_release}"
16+
get_koji_build_id "make" "$koji_tag"
1717
rlPhaseEnd
1818

1919
rlPhaseStartTest "Test koji.build provider with command-line override"

‎tests/prepare/artifact/providers/koji-nvr/test.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rlJournalStart
1313
setup_distro_environment
1414

1515
# Get koji NVR for make
16-
get_koji_nvr "make" "f${fedora_release}"
16+
get_koji_nvr "make" "$koji_tag"
1717
rlPhaseEnd
1818

1919
rlPhaseStartTest "Test koji.nvr provider"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
adjust:
2+
# TODO: Handle centos artifacts also
3+
- when: distro != fedora
4+
enabled: false
5+
because: Need to dynamically handle centos/brew/epel artifacts somehow also

‎tests/prepare/artifact/providers/multi/main.fmf‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@ summary: Test multiple artifact providers
22
description: |
33
Test using multiple artifact providers together in a single
44
prepare step.
5+
6+
# FIXME: docker-ce.repo does not support Fedora 44+, pick a stable
7+
# repository-file source available on all Fedora releases and remove this gate.
8+
adjust+:
9+
- when: distro ~> fedora-43
10+
enabled: false
11+
because: docker-ce.repo does not support Fedora 44+

‎tests/prepare/artifact/providers/multi/test.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rlJournalStart
1313
setup_distro_environment
1414

1515
# Get koji build ID for make
16-
get_koji_build_id "make" "f${fedora_release}"
16+
get_koji_build_id "make" "$koji_tag"
1717
rlPhaseEnd
1818

1919
rlPhaseStartTest "Test multiple providers with command-line override"

‎tests/prepare/artifact/providers/repository-file/main.fmf‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@ summary: Test repository-file artifact provider
22
description: |
33
Test repository-file artifact provider which configures external
44
package repositories from .repo files or URLs.
5+
6+
# FIXME: docker-ce.repo does not support Fedora 44+, pick a stable
7+
# repository-file source available on all Fedora releases and remove this gate.
8+
adjust+:
9+
- when: distro ~> fedora-43
10+
enabled: false
11+
because: docker-ce.repo does not support Fedora 44+

0 commit comments

Comments
 (0)