Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add/use common definition for container repo/tag to use #3294

Merged
Merged
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
3 changes: 2 additions & 1 deletion tests/kola/binfmt/qemu
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ set -xeuo pipefail
# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

container=$(get_fedora_container_ref)
case "$(arch)" in
aarch64|ppc64le|s390x)
containerArch=$(podman run --arch=amd64 --rm quay.io/fedora/fedora:40 arch)
containerArch=$(podman run --arch=amd64 --rm "${container}" arch)
if [ "$containerArch" != "x86_64" ]; then
fatal "Test failed: x86_64 qemu emulator failed to run"
fi
Expand Down
2 changes: 1 addition & 1 deletion tests/kola/containers/quadlet/config.bu
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ storage:
Description=A minimal container

[Container]
Image=quay.io/fedora/fedora-minimal:40
Image=quay.io/fedora/fedora-minimal:latest
Exec=sleep 60
Volume=test.volume:/data
Network=test.network
Expand Down
2 changes: 1 addition & 1 deletion tests/kola/containers/quadlet/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if ! is_service_active test.service; then
fatal "test-network.service failed to start"
fi
container_info=$(podman container inspect systemd-test)
if [[ "$(jq -r '.[0].ImageName' <<< "$container_info")" != "quay.io/fedora/fedora-minimal:40" ]]; then
if [[ "$(jq -r '.[0].ImageName' <<< "$container_info")" != "quay.io/fedora/fedora-minimal:latest" ]]; then
fatal "Container not using the correct image"
fi
if [[ "$(jq -r '.[0].NetworkSettings.Networks[].NetworkID' <<< "$container_info")" != "systemd-test" ]]; then
Expand Down
12 changes: 12 additions & 0 deletions tests/kola/data/commonlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ get_ipv4_for_nic() {
echo "$ip"
}

get_fedora_container_ref() {
local repo='quay.io/fedora/fedora'
local tag='41'
echo "${repo}:${tag}"
}

get_fedora_minimal_container_ref() {
local repo='quay.io/fedora/fedora-minimal'
local tag='41'
echo "${repo}:${tag}"
}

get_fcos_stream() {
rpm-ostree status -b --json | jq -r '.deployments[0]["base-commit-meta"]["fedora-coreos.stream"]'
}
Expand Down
3 changes: 2 additions & 1 deletion tests/kola/docker/basic
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set -xeuo pipefail
# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

docker run --rm quay.io/fedora/fedora:40 true
container=$(get_fedora_minimal_container_ref)
docker run --rm "${container}" true

ok "basic docker run successfully"
3 changes: 2 additions & 1 deletion tests/kola/ntp/data/ntplib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ ntp_test_setup() {

# run podman commands to set up dnsmasq server
pushd "$(mktemp -d)"
container=$(get_fedora_container_ref)
cat <<EOF >Dockerfile
FROM quay.io/fedora/fedora:40
FROM $container
RUN rm -f /etc/yum.repos.d/*.repo \
&& curl -L https://raw.githubusercontent.com/coreos/fedora-coreos-config/testing-devel/fedora-archive.repo -o /etc/yum.repos.d/fedora-archive.repo
RUN dnf -y install systemd dnsmasq iproute iputils \
Expand Down
7 changes: 4 additions & 3 deletions tests/kola/podman/dns/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ set -xeuo pipefail
# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

runascoreuserscript='
container=$(get_fedora_minimal_container_ref)
runascoreuserscript="
#!/bin/bash
set -euxo pipefail

podman network create testnetwork
podman run --rm -t --network=testnetwork quay.io/fedora/fedora:40 getent hosts google.com
podman run --rm -t --network=testnetwork $container getent hosts google.com
podman network rm testnetwork
'
"

runascoreuser() {
# NOTE: If we don't use `| cat` the output won't get copied
Expand Down
11 changes: 6 additions & 5 deletions tests/kola/podman/rootless-pasta-networking
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ set -xeuo pipefail
# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

runascoreuserscript='#!/bin/bash
container=$(get_fedora_minimal_container_ref)
runascoreuserscript="#!/bin/bash
set -euxo pipefail
# Just a basic test that uses pasta network and sets the gateway
podman run -i --rm --net=pasta:--mtu,1500 quay.io/fedora/fedora:40 bash <<"EOF"
podman run -i --rm --net=pasta:--mtu,1500 $container bash <<'EOF'
set -euxo pipefail
# Verify the mtu got set to 1500. No /sbin/ip so just use /sys/class/net/<nic>/mtu
cat /sys/class/net/e*/mtu | grep 1500
# Download something from the internet. Here we use one of the test
# fixtures from the ignition.resource.remote test.
result=$(curl https://ignition-test-fixtures.s3.amazonaws.com/resources/anonymous)
[ "$result" == "kola-anonymous" ] || exit 1
result=\$(curl https://ignition-test-fixtures.s3.amazonaws.com/resources/anonymous)
[ \$result == 'kola-anonymous' ] || exit 1
EOF
'
"

runascoreuser() {
# NOTE: If we don't use `| cat` the output won't get copied
Expand Down
13 changes: 7 additions & 6 deletions tests/kola/podman/rootless-systemd
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,32 @@ set -xeuo pipefail
# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

runascoreuserscript='
container=$(get_fedora_container_ref)
runascoreuserscript="
#!/bin/bash
set -euxo pipefail

# build systemd container (runs httpd via systemd)
# NOTE: we may want to not build this in the future and run
# from a common testutils container. See
# https://github.com/coreos/coreos-assembler/issues/1645
cd $(mktemp -d)
cd \$(mktemp -d)
cat <<EOF > Containerfile
FROM quay.io/fedora/fedora:40
FROM $container
RUN rm -f /etc/yum.repos.d/*.repo \
&& curl -L https://raw.githubusercontent.com/coreos/fedora-coreos-config/testing-devel/fedora-archive.repo -o /etc/yum.repos.d/fedora-archive.repo
RUN dnf -y update \
&& dnf -y install systemd httpd \
&& dnf clean all \
&& systemctl enable httpd
ENTRYPOINT [ "/sbin/init" ]
ENTRYPOINT [ \"/sbin/init\" ]
EOF
podman build -t httpd .

# Run systemd container
# Pass `-t` so systemd will print logs so `podman logs` will work
# Pass '-t' so systemd will print logs so 'podman logs' will work
podman run -t -d --name httpd --publish 8080:80 httpd
'
"

runascoreuser() {
# NOTE: If we don't use `| cat` the output won't get copied
Expand Down
3 changes: 2 additions & 1 deletion tests/kola/selinux/podman-tmpfs-context
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ set -xeuo pipefail
# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

context=$(podman run --rm --privileged quay.io/fedora/fedora:40 \
container=$(get_fedora_minimal_container_ref)
context=$(podman run --rm --privileged "${container}" \
bash -c "mount -t tmpfs tmpfs /mnt/ && stat --format '%C' /mnt/")
if [ "$context" != "system_u:object_r:container_file_t:s0" ]; then
fatal "SELinux context for files on a tmpfs inside a container is wrong"
Expand Down
Loading