mirror of
https://github.com/containers/podman
synced 2024-10-21 01:34:37 +00:00
Use systemctl in local system test
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
This commit is contained in:
parent
ece0c7e5d3
commit
7494876000
|
@ -9,6 +9,7 @@ load helpers.systemd
|
||||||
SERVICE_NAME="podman_test_$(random_string)"
|
SERVICE_NAME="podman_test_$(random_string)"
|
||||||
|
|
||||||
UNIT_FILE="$UNIT_DIR/$SERVICE_NAME.service"
|
UNIT_FILE="$UNIT_DIR/$SERVICE_NAME.service"
|
||||||
|
TEMPLATE_FILE_PREFIX="$UNIT_DIR/$SERVICE_NAME"
|
||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
skip_if_remote "systemd tests are meaningless over remote"
|
skip_if_remote "systemd tests are meaningless over remote"
|
||||||
|
@ -206,8 +207,37 @@ LISTEN_FDNAMES=listen_fdnames" "LISTEN Environment passed: $context"
|
||||||
run_podman run -dt --name $cname $IMAGE top
|
run_podman run -dt --name $cname $IMAGE top
|
||||||
|
|
||||||
run_podman generate systemd --template -n $cname
|
run_podman generate systemd --template -n $cname
|
||||||
is "$output" ".*%I.*" "%I indentifiers in template"
|
echo "$output" > "$TEMPLATE_FILE_PREFIX@.service"
|
||||||
is "$output" ".*%i.*" "%i indentifiers in template"
|
run_podman rm -f $cname
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
INSTANCE="$SERVICE_NAME@1.service"
|
||||||
|
run systemctl start "$INSTANCE"
|
||||||
|
if [ $status -ne 0 ]; then
|
||||||
|
die "Error starting systemd unit $INSTANCE, output: $output"
|
||||||
|
fi
|
||||||
|
|
||||||
|
run systemctl status "$INSTANCE"
|
||||||
|
if [ $status -ne 0 ]; then
|
||||||
|
die "Non-zero status of systemd unit $INSTANCE, output: $output"
|
||||||
|
fi
|
||||||
|
|
||||||
|
run systemctl stop "$INSTANCE"
|
||||||
|
if [ $status -ne 0 ]; then
|
||||||
|
die "Error stopping systemd unit $INSTANCE, output: $output"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$status" ]]; then
|
||||||
|
run systemctl is-active "$INSTANCE"
|
||||||
|
if [ $status -ne 0 ]; then
|
||||||
|
die "Error checking stauts of systemd unit $INSTANCE, output: $output"
|
||||||
|
fi
|
||||||
|
is "$output" "$status" "$INSTANCE not in expected state"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "$TEMPLATE_FILE_PREFIX@.service"
|
||||||
|
systemctl daemon-reload
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "podman generate - systemd template no support for pod" {
|
@test "podman generate - systemd template no support for pod" {
|
||||||
|
|
Loading…
Reference in a new issue