summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
Diffstat (limited to 'test/system')
-rw-r--r--test/system/130-kill.bats4
-rw-r--r--test/system/160-volumes.bats16
-rw-r--r--test/system/250-systemd.bats30
-rw-r--r--test/system/330-corrupt-images.bats13
4 files changed, 39 insertions, 24 deletions
diff --git a/test/system/130-kill.bats b/test/system/130-kill.bats
index 3770eac27..d85f0a6a9 100644
--- a/test/system/130-kill.bats
+++ b/test/system/130-kill.bats
@@ -33,7 +33,7 @@ load helpers
exec 5<$fifo
# First container emits READY when ready; wait for it.
- read -t 10 -u 5 ready
+ read -t 60 -u 5 ready
is "$ready" "READY" "first log message from container"
# Helper function: send the given signal, verify that it's received.
@@ -42,7 +42,7 @@ load helpers
local signum=${2:-$1} # e.g. if signal=HUP, we expect to see '1'
run_podman kill -s $signal $cid
- read -t 10 -u 5 actual || die "Timed out: no ACK for kill -s $signal"
+ read -t 60 -u 5 actual || die "Timed out: no ACK for kill -s $signal"
is "$actual" "got: $signum" "Signal $signal handled by container"
}
diff --git a/test/system/160-volumes.bats b/test/system/160-volumes.bats
index 9a852db89..f6dc3f0af 100644
--- a/test/system/160-volumes.bats
+++ b/test/system/160-volumes.bats
@@ -186,6 +186,22 @@ EOF
}
+# Podman volume import test
+@test "podman volume import test" {
+ skip_if_remote "volumes import is not applicable on podman-remote"
+ run_podman volume create my_vol
+ run_podman run --rm -v my_vol:/data $IMAGE sh -c "echo hello >> /data/test"
+ run_podman volume create my_vol2
+ run_podman volume export my_vol --output=hello.tar
+ # we want to use `run_podman volume export my_vol` but run_podman is wrapping EOF
+ cat hello.tar | run_podman volume import my_vol2 -
+ run_podman run --rm -v my_vol2:/data $IMAGE sh -c "cat /data/test"
+ is "$output" "hello" "output from second container"
+ run_podman volume rm my_vol
+ run_podman volume rm my_vol2
+}
+
+
# Confirm that container sees the correct id
@test "podman volume with --userns=keep-id" {
is_rootless || skip "only meaningful when run rootless"
diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats
index 37e5fa2f9..5d4ae4cb1 100644
--- a/test/system/250-systemd.bats
+++ b/test/system/250-systemd.bats
@@ -46,11 +46,20 @@ function service_setup() {
# Helper to stop a systemd service running a container
function service_cleanup() {
+ local status=$1
run systemctl stop "$SERVICE_NAME"
if [ $status -ne 0 ]; then
die "Error stopping systemd unit $SERVICE_NAME, output: $output"
fi
+ if [[ -z "$status" ]]; then
+ run systemctl is-active "$SERVICE_NAME"
+ if [ $status -ne 0 ]; then
+ die "Error checking stauts of systemd unit $SERVICE_NAME, output: $output"
+ fi
+ is "$output" "$status" "$SERVICE_NAME not in expected state"
+ fi
+
rm -f "$UNIT_FILE"
systemctl daemon-reload
}
@@ -60,7 +69,8 @@ function service_cleanup() {
@test "podman generate - systemd - basic" {
cname=$(random_string)
# See #7407 for --pull=always.
- run_podman create --pull=always --name $cname --label "io.containers.autoupdate=registry" $IMAGE top
+ run_podman create --pull=always --name $cname --label "io.containers.autoupdate=registry" $IMAGE \
+ sh -c "trap 'echo Received SIGTERM, finishing; exit' SIGTERM; echo WAITING; while :; do sleep 0.1; done"
# Start systemd service to run this container
service_setup
@@ -68,7 +78,7 @@ function service_cleanup() {
# Give container time to start; make sure output looks top-like
sleep 2
run_podman logs $cname
- is "$output" ".*Load average:.*" "running container 'top'-like output"
+ is "$output" ".*WAITING.*" "running is waiting for signal"
# Exercise `podman auto-update`.
# TODO: this will at least run auto-update code but won't perform an update
@@ -77,7 +87,8 @@ function service_cleanup() {
run_podman auto-update
# All good. Stop service, clean up.
- service_cleanup
+ # Also make sure the service is in the `inactive` state (see #11304).
+ service_cleanup inactive
}
@test "podman autoupdate local" {
@@ -125,17 +136,4 @@ function service_cleanup() {
service_cleanup
}
-@test "podman generate systemd - stop-signal" {
- cname=$(random_string)
- run_podman create --name $cname --stop-signal=42 $IMAGE
- run_podman generate systemd --new $cname
- is "$output" ".*KillSignal=42.*" "KillSignal is set"
-
- # Regression test for #11304: systemd wants a custom stop-signal.
- run_podman rm -f $cname
- run_podman create --name $cname --systemd=true $IMAGE systemd
- run_podman generate systemd --new $cname
- is "$output" ".*KillSignal=37.*" "KillSignal is set"
-}
-
# vim: filetype=sh
diff --git a/test/system/330-corrupt-images.bats b/test/system/330-corrupt-images.bats
index 2ee5eee9c..eeffff3ec 100644
--- a/test/system/330-corrupt-images.bats
+++ b/test/system/330-corrupt-images.bats
@@ -13,7 +13,8 @@ if [ -z "${PODMAN_CORRUPT_TEST_WORKDIR}" ]; then
export PODMAN_CORRUPT_TEST_WORKDIR=$(mktemp -d --tmpdir=${BATS_TMPDIR:-${TMPDIR:-/tmp}} podman_corrupt_test.XXXXXX)
fi
-PODMAN_CORRUPT_TEST_IMAGE_FQIN=quay.io/libpod/alpine@sha256:634a8f35b5f16dcf4aaa0822adc0b1964bb786fca12f6831de8ddc45e5986a00
+PODMAN_CORRUPT_TEST_IMAGE_CANONICAL_FQIN=quay.io/libpod/alpine@sha256:634a8f35b5f16dcf4aaa0822adc0b1964bb786fca12f6831de8ddc45e5986a00
+PODMAN_CORRUPT_TEST_IMAGE_TAGGED_FQIN=${PODMAN_CORRUPT_TEST_IMAGE_CANONICAL_FQIN%%@sha256:*}:test
PODMAN_CORRUPT_TEST_IMAGE_ID=961769676411f082461f9ef46626dd7a2d1e2b2a38e6a44364bcbecf51e66dd4
# All tests in this file (and ONLY in this file) run with a custom rootdir
@@ -59,7 +60,7 @@ function _corrupt_image_test() {
run_podman load -i ${PODMAN_CORRUPT_TEST_WORKDIR}/img.tar
# "podman load" restores it without a tag, which (a) causes rmi-by-name
# to fail, and (b) causes "podman images" to exit 0 instead of 125
- run_podman tag ${PODMAN_CORRUPT_TEST_IMAGE_ID} ${PODMAN_CORRUPT_TEST_IMAGE_FQIN}
+ run_podman tag ${PODMAN_CORRUPT_TEST_IMAGE_ID} ${PODMAN_CORRUPT_TEST_IMAGE_TAGGED_FQIN}
# shortcut variable name
local id=${PODMAN_CORRUPT_TEST_IMAGE_ID}
@@ -91,9 +92,9 @@ function _corrupt_image_test() {
@test "podman corrupt images - initialize" {
# Pull once, save cached copy.
- run_podman pull $PODMAN_CORRUPT_TEST_IMAGE_FQIN
+ run_podman pull $PODMAN_CORRUPT_TEST_IMAGE_CANONICAL_FQIN
run_podman save -o ${PODMAN_CORRUPT_TEST_WORKDIR}/img.tar \
- $PODMAN_CORRUPT_TEST_IMAGE_FQIN
+ $PODMAN_CORRUPT_TEST_IMAGE_CANONICAL_FQIN
}
# END first "test" does a one-time pull of our desired image
@@ -104,8 +105,8 @@ function _corrupt_image_test() {
_corrupt_image_test "rmi -f ${PODMAN_CORRUPT_TEST_IMAGE_ID}"
}
-@test "podman corrupt images - rmi -f <image-name>" {
- _corrupt_image_test "rmi -f ${PODMAN_CORRUPT_TEST_IMAGE_FQIN}"
+@test "podman corrupt images - rmi -f <image-tagged-name>" {
+ _corrupt_image_test "rmi -f ${PODMAN_CORRUPT_TEST_IMAGE_TAGGED_FQIN}"
}
@test "podman corrupt images - rmi -f -a" {