spiegel_podman/test/system
Ricardo Branco 2d1868ff60
test/system: Fix "command not found" with wait builtin
Only on Fedora there's a /bin/wait shell script that calls Bash's
builtin(1).  This is not the case of openSUSE Tumbleweed with the same
Bash version and Debian 13.  Otherwise we get errors from bats like:

BW01: `run`'s command `wait 872594` exited with code 127, indicating
'Command not found'. Use run's return code checks, e.g. `run -127`,
to fix this message.

Replace `run wait` with `wait || true` like it's done in other tests.

Signed-off-by: Ricardo Branco <rbranco@suse.de>
2026-06-16 10:39:16 +02:00
..
000-TEMPLATE
001-basic.bats
005-info.bats test: Remove slirp4netns-specific test cases 2026-04-13 08:22:35 -04:00
010-images.bats
011-image.bats
012-manifest.bats Move to deterministic network setup order 2026-04-17 10:00:32 -04:00
015-help.bats
020-tag.bats
030-run.bats test/system: do not use image mount as rootfs source 2026-06-01 13:01:34 +02:00
032-sig-proxy.bats
035-logs.bats
037-runlabel.bats
040-ps.bats ps: format labels as comma separated key=value for Docker compatibility 2026-04-30 18:04:49 +02:00
045-start.bats
050-stop.bats Fix stop timing flake by widening upper bound 2026-06-09 14:57:28 +02:00
055-rm.bats fix flaky "rm --force" stopping-state detection 2026-06-09 14:57:24 +02:00
060-mount.bats
065-cp.bats
070-build.bats Use tmp context dir when building with process substitution 2026-05-08 10:39:38 -04:00
075-exec.bats
080-pause.bats test/system: do not run "podman pause/unpause" in parallel 2026-05-27 12:44:40 +02:00
085-top.bats
090-events.bats events: include labels in pod and volume attributes 2026-06-09 20:36:04 +09:00
110-history.bats
120-load.bats Add --format to image scp 2026-03-19 17:42:33 +01:00
125-import.bats
126-commit.bats cmd, commit: change --pause default to true 2026-06-03 07:28:22 +02:00
130-kill.bats test/system: fix "podman kill - concurrent stop" 2026-05-28 13:37:42 +02:00
140-diff.bats
150-login.bats
155-partial-pull.bats
156-pull-policy.bats
160-volumes.bats volume ls: format labels as comma-separated key=value strings 2026-04-30 18:05:06 +02:00
161-volume-quotas.bats
170-run-userns.bats
180-blkio.bats
190-run-ipcns.bats
195-run-namespaces.bats test: relax rootless runc pid namespace assertion 2026-03-21 21:43:37 +01:00
200-pod.bats ps: format labels as comma separated key=value for Docker compatibility 2026-04-30 18:04:49 +02:00
220-healthcheck.bats Fix healthcheck flake by capturing time before systemctl checks 2026-06-09 14:57:27 +02:00
221-healthcheck-transient.bats Fix healthcheck failing silently with --transient-store 2026-04-14 14:13:20 +02:00
250-systemd.bats test/system: use DISABLE_HC_SYSTEMD for 2 tests 2026-05-28 13:37:42 +02:00
251-system-service.bats
252-quadlet.bats test/system: fix "quadlet kube - start error" flake 2026-06-01 21:02:30 +02:00
253-podman-quadlet.bats feat: update podman quadlet sub-command 2026-06-02 09:52:49 +00:00
254-podman-quadlet-multi.bats feat: update podman quadlet sub-command 2026-06-02 09:52:49 +00:00
255-auto-update.bats
260-sdnotify.bats test/system: Fix 260-sdnotify being silently skipped 2026-04-05 16:43:40 +02:00
270-socket-activation.bats
271-tcp-cors-server.bats
272-system-connection.bats test/system: Fix "command not found" with wait builtin 2026-06-16 10:39:16 +02:00
273-remote-spot-check.bats
280-update.bats
300-cli-parsing.bats
320-system-df.bats
330-corrupt-images.bats
331-system-check.bats
400-unprivileged-access.bats
410-selinux.bats
420-cgroups.bats
450-interactive.bats
500-networking.bats test/system: skip one new pasta flake 2026-05-27 12:44:40 +02:00
505-networking-pasta.bats test/system: skip "IPv6 default address assignment" 2026-05-27 12:44:39 +02:00
520-checkpoint.bats test/system: skip podman checkpoint --export, with volumes on aarch64 2026-04-23 20:48:55 +02:00
550-pause-process.bats rootless: detect and remove stale pause.pid with recycled PIDs 2026-03-19 14:46:29 +01:00
600-completion.bats
610-format.bats
620-option-conflicts.bats
700-play.bats test: Remove slirp4netns-specific test cases 2026-04-13 08:22:35 -04:00
702-artifact.bats libpod: validate artifact volume on create 2026-02-12 18:24:16 +01:00
710-kube.bats test: Use yq for yaml2json when available 2026-02-22 11:29:27 +01:00
750-trust.bats trust: switch policy.json lookup to configfile 2026-04-20 15:11:22 +02:00
760-system-renumber.bats
800-config.bats test/system: re-enable module command line completion test 2026-04-27 12:54:05 +02:00
850-compose.bats
900-ssh.bats
950-preexec-hooks.bats
build-systemd-image
build-testimage
helpers.bash test/system: fix some teardown error logging 2026-03-02 12:58:27 -08:00
helpers.network.bash libpod: replace listen with socket+bind for dual-stack port reservation 2026-05-11 13:21:12 +05:30
helpers.registry.bash
helpers.sig-proxy.bash
helpers.systemd.bash
helpers.t libpod: replace listen with socket+bind for dual-stack port reservation 2026-05-11 13:21:12 +05:30
README.md
setup_suite.bash

Quick overview of podman system tests. The idea is to use BATS, but with a framework for making it easy to add new tests and to debug failures.

Quick Start

Look at 000-TEMPLATE for a simple starting point. This introduces the basic set of helper functions:

  • setup (implicit) - establishes a test environment.

  • parse_table - you can define tables of inputs and expected results, then read those in a while loop. This makes it easy to add new tests. Because bash is not a programming language, the caller of parse_table sometimes needs to massage the returned values; 030-run.bats offers examples of how to deal with the more typical such issues.

  • run_podman - runs command defined in $PODMAN (default: 'podman' but could also be './bin/podman' or 'podman-remote'), with a timeout. Checks its exit status.

  • assert - compare actual vs expected output. Emits a useful diagnostic on failure.

  • die - output a properly-formatted message to stderr, and fail test

  • skip_if_rootless - if rootless, skip this test with a helpful message.

  • skip_if_remote - like the above, but skip if testing podman-remote

  • safename - generates a pseudorandom lower-case string suitable for use in names for containers, images, volumes, any object. String includes the BATS test number, making it possible to identify the source of leaks (failure to clean up) at the end of tests.

  • random_string - returns a pseudorandom alphanumeric string suitable for verifying I/O.

Test files are of the form NNN-name.bats where NNN is a three-digit number. Please preserve this convention, it simplifies viewing the directory and understanding test order. In particular, 00x tests should be reserved for a first-pass fail-fast subset of tests:

bats test/system/00*.bats || exit 1
bats test/system

...the goal being to provide quick feedback on catastrophic failures without having to wait for the entire test suite.

Running tests

To run the tests locally in your sandbox using hack/bats is recommend, check hack/bats --help for info about usage.

To run the entire suite use make localsystem or make remotesystem for podman-remote testing.

Analyzing test failures

The top priority for this scheme is to make it easy to diagnose what went wrong. To that end, podman_run always logs all invoked commands, their output and exit codes. In a normal run you will never see this, but BATS will display it on failure. The goal here is to give you everything you need to diagnose without having to rerun tests.

The assert comparison function is designed to emit useful diagnostics, in particular, the actual and expected strings. Please do not use the horrible BATS standard of [ x = y ]; that's nearly useless for tracking down failures.

If the above are not enough to help you track down a failure:

Debugging tests

Some functions have dprint statements. To see the output of these, set PODMAN_TEST_DEBUG="funcname" where funcname is the name of the function or perhaps just a substring.

Requirements

  • bats
  • jq
  • skopeo
  • httpd-tools
  • openssl
  • socat
  • buildah
  • gnupg
  • xfsprogs

Further Details

TBD. For now, look in helpers.bash; each helper function has (what are intended to be) helpful header comments. For even more examples, see and/or run helpers.t; that's a regression test and provides a thorough set of examples of how the helpers work.