blob: a8eb3b0a6b658b1c659f3a539e53c84c06360a0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#!/usr/bin/env bats -*- bats -*-
#
# Tests generated configurations for systemd.
#
load helpers
# Be extra paranoid in naming to avoid collisions.
SERVICE_NAME="podman_test_$(random_string)"
UNIT_DIR="$HOME/.config/systemd/user"
UNIT_FILE="$UNIT_DIR/$SERVICE_NAME.service"
function setup() {
basic_setup
if [ ! -d "$UNIT_DIR" ]; then
mkdir -p "$UNIT_DIR"
systemctl --user daemon-reload
fi
}
function teardown() {
rm -f "$UNIT_FILE"
systemctl --user stop "$SERVICE_NAME"
basic_teardown
}
@test "podman generate - systemd - basic" {
skip_if_not_systemd
skip_if_remote
run_podman create $IMAGE echo "I'm alive!"
cid="$output"
run_podman generate systemd $cid > "$UNIT_FILE"
run systemctl --user start "$SERVICE_NAME"
if [ $status -ne 0 ]; then
die "The systemd service $SERVICE_NAME did not start correctly, output: $output"
fi
run_podman logs $cid
is "$output" "I'm alive!" "Container output"
}
# vim: filetype=sh
|