forked from coreos/fedora-coreos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/kola: add podman.rootless-pasta-networking test
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
## kola: | ||
## description: Verify that rootless pasta networking passt works. | ||
## # This test downloads containers and curls from the net. | ||
## tags: "platform-independent needs-internet" | ||
## # This test doesn't make meaningful changes to the system and | ||
## # should be able to be combined with other tests. | ||
## exclusive: false | ||
## # This test reaches out to the internet and it could take more | ||
## # time to pull down the container. | ||
## timeoutMin: 3 | ||
|
||
# See https://github.com/coreos/fedora-coreos-tracker/issues/1436 | ||
|
||
set -xeuo pipefail | ||
. $KOLA_EXT_DATA/commonlib.sh | ||
|
||
runascoreuserscript='#!/bin/bash | ||
set -euxo pipefail | ||
# Just a basic test that uses pasta network and sets the gateway | ||
podman run -i --net=pasta:-g,8.8.8.8 registry.fedoraproject.org/fedora:38 bash <<"EOF" | ||
set -euxo pipefail | ||
# Verify the 8.8.8.8 got set as the gateway. No /sbin/ip so just use /proc/net/route | ||
cat /proc/net/route | grep 08080808 | ||
# 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 | ||
EOF | ||
' | ||
|
||
runascoreuser() { | ||
# NOTE: If we don't use `| cat` the output won't get copied | ||
# to our unit and won't show up in the `systemctl status` output | ||
# of the ext test. | ||
sudo -u core "$@" | cat | ||
} | ||
|
||
main() { | ||
|
||
# Execute script as the core user to exercise rootless podman | ||
runascoreuserscriptpath=$(mktemp --suffix=runascoreuser) | ||
echo "$runascoreuserscript" > $runascoreuserscriptpath | ||
chmod +x $runascoreuserscriptpath | ||
chown core $runascoreuserscriptpath | ||
if runascoreuser $runascoreuserscriptpath; then | ||
ok "Podman with pasta networking succeeded!" | ||
else | ||
fatal "Podman with pasta networking failed" | ||
fi | ||
} | ||
|
||
main |