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

Add basic test for podman-quadlet #2216

Merged
merged 2 commits into from
Feb 10, 2023
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
6 changes: 6 additions & 0 deletions manifest-lock.overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ packages:
metadata:
bodhi: https://bodhi.fedoraproject.org/updates/FEDORA-2023-e1cd8776f0
type: fast-track
podman:
evr: 5:4.4.1-1.fc37
metadata:
bodhi: https://bodhi.fedoraproject.org/updates/FEDORA-2023-539e1ce6d7
reason: https://github.com/coreos/fedora-coreos-tracker/issues/998
type: fast-track
36 changes: 36 additions & 0 deletions tests/kola/containers/quadlet/config.bu
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
variant: fcos
version: 1.4.0
storage:
files:
- path: /etc/containers/systemd/test.container
contents:
inline: |
[Unit]
Description=A minimal container

[Container]
Image=registry.fedoraproject.org/fedora-minimal
Exec=sleep 60
Volume=test.volume:/data
Network=test.network

[Service]
Restart=always

[Install]
WantedBy=multi-user.target default.target
- path: /etc/containers/systemd/test.volume
contents:
inline: |
[Volume]
User=root
Group=root
Label=org.test.Key=quadlet-test-volume
- path: /etc/containers/systemd/test.network
contents:
inline: |
[Network]
Subnet=172.16.0.0/24
Gateway=172.16.0.1
IPRange=172.16.0.0/28
Label=org.test.Key=quadlet-test-network
1 change: 1 addition & 0 deletions tests/kola/containers/quadlet/data/commonlib.sh
32 changes: 32 additions & 0 deletions tests/kola/containers/quadlet/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
## kola:
## # We're pulling a container image from Quay.io
## tags: "platform-independent needs-internet"
Copy link
Member

Choose a reason for hiding this comment

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

I think we do have other tests that pull containers that are exclusive: false. This one is probably on the fence of "making meaningful changes to the system" or not so I could go either way.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. We'll setup networks for containers and volumes. This should not interact with other things but the more container related tests we merge the more likely we'll have issues.

#
# Ensure that basic quadlet functionality works

set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

if [[ "$(podman volume inspect systemd-test | jq -r '.[0].Labels."org.test.Key"')" != "quadlet-test-volume" ]]; then
fatal "Volume not correctly created"
fi

if [[ "$(podman network inspect systemd-test | jq -r '.[0].labels."org.test.Key"')" != "quadlet-test-network" ]]; then
fatal "Network not correctly created"
fi

if [[ "$(podman inspect systemd-test | jq -r '.[0].ImageName')" != "registry.fedoraproject.org/fedora-minimal:latest" ]]; then
fatal "Container not using the correct image"
fi

if [[ "$(podman inspect systemd-test | jq -r '.[0].NetworkSettings.Networks[].NetworkID')" != "systemd-test" ]]; then
fatal "Container not using the correct network"
fi

if [[ "$(podman inspect systemd-test | jq -r '.[0].HostConfig.Binds[0]')" != "systemd-test:/data:rw,rprivate,nosuid,nodev,rbind" ]]; then
fatal "Container not using the correct volume"
fi

ok "Successfully tested basic quadlet functionality"