Skip to content

Commit

Permalink
Add Debian 12.7 among container test images
Browse files Browse the repository at this point in the history
  • Loading branch information
happz committed Oct 21, 2024
1 parent 6e4742b commit 0252ffd
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 9 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ TMT_TEST_CONTAINER_IMAGES := $(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/alpine:late
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/39/upstream:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/39/unprivileged:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/ubi/8/upstream:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/ubuntu/22.04/upstream:latest
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/ubuntu/22.04/upstream:latest \
$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/debian/12.7/upstream:latest

TMT_TEST_IMAGES_TARGETS := $(foreach image,$(TMT_TEST_CONTAINER_IMAGES),images-tests/$(subst :,\:,$(image)))

Expand Down Expand Up @@ -197,6 +198,9 @@ $(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/ubi/8/up
$(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/ubuntu/22.04/upstream\:latest:
$(call build-test-container-image,$@,ubuntu/22.04/Containerfile.upstream)

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

##
## Development
##
Expand Down
10 changes: 10 additions & 0 deletions containers/debian/12.7/Containerfile.upstream
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# A Debian image tailored for tmt test suite
#
# tmt/tests/debian/12.7/upstream:latest
#

FROM docker.io/library/debian:12.7

# Populate apt cache
RUN apt update
10 changes: 9 additions & 1 deletion tests/images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ $TEST_IMAGE_PREFIX/fedora/rawhide/upstream:latest
$TEST_IMAGE_PREFIX/fedora/coreos:stable
$TEST_IMAGE_PREFIX/fedora/coreos/ostree:stable
$TEST_IMAGE_PREFIX/ubi/8/upstream:latest
$TEST_IMAGE_PREFIX/ubuntu/22.04/upstream:latest}"
$TEST_IMAGE_PREFIX/ubuntu/22.04/upstream:latest
$TEST_IMAGE_PREFIX/debian/12.7/upstream:latest}"

# Basic set of virtual images to test on.
#
Expand Down Expand Up @@ -92,6 +93,13 @@ function is_ubuntu () {
return 1
}

function is_debian () {
[[ "$1" =~ ^.*debian/.* ]] && return 0
[[ "$1" = "debian" ]] && return 0

return 1
}

function is_ostree () {
[[ "$1" =~ ^.*fedora/coreos/ostree:stable ]] && return 0
[[ "$1" = "fedora-coreos" && "$PROVISION_HOW" = "virtual" ]] && return 0
Expand Down
2 changes: 1 addition & 1 deletion tests/prepare/install/data/empty.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ summary: Do nothing in prepare, CLI will provide inputs
prepare: []

adjust:
- when: distro == ubuntu
- when: distro == ubuntu,debian
prepare+:
- how: shell
script: apt-get update
2 changes: 1 addition & 1 deletion tests/prepare/install/data/existing.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ summary: Install existing packages
prepare: []

adjust:
- when: distro == ubuntu
- when: distro == ubuntu,debian
prepare+<:
- how: shell
script: apt-get update
Expand Down
2 changes: 1 addition & 1 deletion tests/prepare/install/data/missing.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ prepare:
- diffutils

adjust:
- when: distro == ubuntu
- when: distro == ubuntu,debian
prepare+<:
- how: shell
script: apt-get update
12 changes: 8 additions & 4 deletions tests/prepare/install/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ rlJournalStart
rlRun "distro=ubuntu"
rlRun "package_manager=apt"

elif is_debian "$image"; then
rlRun "distro=debian"
rlRun "package_manager=apt"

elif is_fedora_coreos "$image"; then
rlRun "distro=fedora-coreos"

Expand Down Expand Up @@ -125,7 +129,7 @@ rlJournalStart

rlAssertGrep "package manager: $package_manager$" $rlRun_LOG

if is_ubuntu "$image"; then
if is_ubuntu "$image" || is_debian "$image"; then
# Runs 1 extra phase, to populate local caches.
rlAssertGrep "summary: 3 preparations applied" $rlRun_LOG
else
Expand All @@ -142,7 +146,7 @@ rlJournalStart

rlAssertGrep "package manager: $package_manager$" $rlRun_LOG

if is_ubuntu "$image"; then
if is_ubuntu "$image" || is_debian "$image"; then
# Runs 1 extra phase, to populate local caches.
rlAssertGrep "summary: 3 preparations applied" $rlRun_LOG
else
Expand Down Expand Up @@ -238,7 +242,7 @@ rlJournalStart
elif is_fedora_39 "$image"; then
rlAssertGrep "err: Error: Unable to find a match: tree-but-spelled-wrong" $rlRun_LOG

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

elif is_alpine "$image"; then
Expand Down Expand Up @@ -275,7 +279,7 @@ rlJournalStart
elif is_fedora_39 "$image"; then
rlAssertGrep "err: Error: Unable to find a match: tree-but-spelled-wrong" $rlRun_LOG

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

elif is_alpine "$image"; then
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/test_package_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
url='containers-storage:localhost/tmt/tests/container/ubi/8/upstream:latest')
CONTAINER_UBUNTU_2204 = Container(
url='containers-storage:localhost/tmt/tests/container/ubuntu/22.04/upstream:latest')
CONTAINER_DEBIAN_127 = Container(
url='containers-storage:localhost/tmt/tests/container/debian/12.7/upstream:latest')
CONTAINER_FEDORA_COREOS = Container(
url='containers-storage:localhost/tmt/tests/container/fedora/coreos:stable')
CONTAINER_FEDORA_COREOS_OSTREE = Container(
Expand Down Expand Up @@ -159,6 +161,9 @@ def assert_output(
# Ubuntu
(CONTAINER_UBUNTU_2204, PACKAGE_MANAGER_APT),

# Debian
(CONTAINER_DEBIAN_127, PACKAGE_MANAGER_APT),

# Fedora CoreOS
(CONTAINER_FEDORA_COREOS, PACKAGE_MANAGER_DNF5),
(CONTAINER_FEDORA_COREOS_OSTREE, PACKAGE_MANAGER_RPMOSTREE),
Expand Down

0 comments on commit 0252ffd

Please sign in to comment.