diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-08 16:13:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-08 16:13:13 +0200 |
commit | f4e3ec5fd69a6cc831b63619c5772dbf5c6a11a6 (patch) | |
tree | 63b33c45a319edfc5dc2de549a765eba89c90ae9 /test/system/250-systemd.bats | |
parent | db9940fb42fb199d335dcd549ac24972ef89d5c0 (diff) | |
parent | 42c6aa1a4281d0ac1fc70fc95cca97506b25477e (diff) | |
download | podman-f4e3ec5fd69a6cc831b63619c5772dbf5c6a11a6.tar.gz podman-f4e3ec5fd69a6cc831b63619c5772dbf5c6a11a6.tar.bz2 podman-f4e3ec5fd69a6cc831b63619c5772dbf5c6a11a6.zip |
Merge pull request #6134 from vrothberg/systemd-unit-tests
fix and enable systemd system tests
Diffstat (limited to 'test/system/250-systemd.bats')
-rw-r--r-- | test/system/250-systemd.bats | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats new file mode 100644 index 000000000..902a7cad8 --- /dev/null +++ b/test/system/250-systemd.bats @@ -0,0 +1,49 @@ +#!/usr/bin/env bats -*- bats -*- +# +# Tests generated configurations for systemd. +# + +load helpers + +SERVICE_NAME="podman_test_$(random_string)" +UNIT_DIR="/usr/lib/systemd/system" +UNIT_FILE="$UNIT_DIR/$SERVICE_NAME.service" + +function setup() { + skip_if_remote + skip_if_rootless "systemd tests are root-only for now" + + basic_setup +} + +function teardown() { + rm -f "$UNIT_FILE" + systemctl daemon-reload + basic_teardown +} + +@test "podman generate - systemd - basic" { + run_podman create --name keepme --detach busybox:latest top + + run_podman generate systemd --new keepme > "$UNIT_FILE" + run_podman rm keepme + + systemctl daemon-reload + + run systemctl start "$SERVICE_NAME" + if [ $status -ne 0 ]; then + die "Error starting systemd unit $SERVICE_NAME, output: $output" + fi + + run systemctl status "$SERVICE_NAME" + if [ $status -ne 0 ]; then + die "Non-zero status of systemd unit $SERVICE_NAME, output: $output" + fi + + run systemctl stop "$SERVICE_NAME" + if [ $status -ne 0 ]; then + die "Error stopping systemd unit $SERVICE_NAME, output: $output" + fi +} + +# vim: filetype=sh |