summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
Diffstat (limited to 'test/system')
-rw-r--r--test/system/005-info.bats4
-rw-r--r--test/system/030-run.bats4
-rw-r--r--test/system/070-build.bats3
-rw-r--r--test/system/120-load.bats4
-rw-r--r--test/system/250-generate-systemd.bats46
-rw-r--r--test/system/README.md9
-rw-r--r--test/system/helpers.bash11
7 files changed, 75 insertions, 6 deletions
diff --git a/test/system/005-info.bats b/test/system/005-info.bats
index 47c7a52fc..0068e35a9 100644
--- a/test/system/005-info.bats
+++ b/test/system/005-info.bats
@@ -14,7 +14,7 @@ Distribution:
OCIRuntime:\\\s\\\+package:
os:
rootless:
-insecure registries:
+registries:
store:
GraphDriverName:
GraphRoot:
@@ -37,9 +37,7 @@ RunRoot:
tests="
host.BuildahVersion | [0-9.]
-host.Conmon.package | $expr_nvr
host.Conmon.path | $expr_path
-host.OCIRuntime.package | $expr_nvr
host.OCIRuntime.path | $expr_path
store.ConfigFile | $expr_path
store.GraphDriverName | [a-z0-9]\\\+\\\$
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index a29b1adc3..cefff0e2c 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -9,8 +9,8 @@ true | 0 |
false | 1 |
sh -c 'exit 32' | 32 |
echo $rand | 0 | $rand
-/no/such/command | 127 | Error: container create failed:.*exec:.* no such file or dir
-/etc | 126 | Error: container create failed:.*exec:.* permission denied
+/no/such/command | 127 | Error: .*: starting container process caused .*exec:.*stat /no/such/command: no such file or directory
+/etc | 126 | Error: .*: starting container process caused .*exec:.* permission denied
"
while read cmd expected_rc expected_output; do
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 53acf6edd..c1e7c7ec4 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -20,15 +20,16 @@ load helpers
dockerfile=$tmpdir/Dockerfile
cat >$dockerfile <<EOF
FROM $IMAGE
+RUN apk add nginx
RUN echo $rand_content > /$rand_filename
EOF
run_podman build -t build_test --format=docker $tmpdir
+ is "$output" ".*STEP 4: COMMIT" "COMMIT seen in log"
run_podman run --rm build_test cat /$rand_filename
is "$output" "$rand_content" "reading generated file in image"
run_podman rmi build_test
}
-
# vim: filetype=sh
diff --git a/test/system/120-load.bats b/test/system/120-load.bats
index dedfe6172..f2dedb73f 100644
--- a/test/system/120-load.bats
+++ b/test/system/120-load.bats
@@ -87,6 +87,10 @@ verify_iid_and_name() {
@test "podman load - will not read from tty" {
+ if [ ! -t 0 ]; then
+ skip "STDIN is not a tty"
+ fi
+
run_podman 125 load
is "$output" \
"Error: cannot read from terminal. Use command-line redirection" \
diff --git a/test/system/250-generate-systemd.bats b/test/system/250-generate-systemd.bats
new file mode 100644
index 000000000..80199af5f
--- /dev/null
+++ b/test/system/250-generate-systemd.bats
@@ -0,0 +1,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() {
+ skip_if_not_systemd
+ skip_if_remote
+
+ 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" {
+ 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
diff --git a/test/system/README.md b/test/system/README.md
index 6ac408f4e..d98b1c0fe 100644
--- a/test/system/README.md
+++ b/test/system/README.md
@@ -42,6 +42,15 @@ should be reserved for a first-pass fail-fast subset of tests:
without having to wait for the entire test suite.
+Running tests
+=============
+To run the tests locally in your sandbox, you can use one of these methods:
+* make;PODMAN=./bin/podman bats ./test/system/070-build.bats # runs just the specified test
+* make;PODMAN=./bin/podman bats ./test/system # runs all
+
+To test as root:
+* $ PODMAN=./bin/podman sudo --preserve-env=PODMAN bats test/system
+
Analyzing test failures
=======================
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 29ef19ecc..1db80f111 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -236,6 +236,17 @@ function skip_if_remote() {
skip "${1:-test does not work with podman-remote}"
}
+#########################
+# skip_if_not_systemd # ...with an optional message
+#########################
+function skip_if_not_systemd() {
+ if systemctl --user >/dev/null 2>&1; then
+ return
+ fi
+
+ skip "${1:-no systemd or daemon does not respond}"
+}
+
#########
# die # Abort with helpful message
#########