pi-hole/test
Adam Warner 1f5960d71b
Merge branch 'development' into fix/debug-redact-secrets
Keep the tests of both sides in test/test_symlink_safety.bats.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Adam Warner <github@promofaux.dev>
2026-11-11 17:31:20 +00:00
..
_alpine_3_21.Dockerfile test: bake BATS libraries into test images at build time 2026-05-21 19:30:20 +01:00
_alpine_3_22.Dockerfile test: bake BATS libraries into test images at build time 2026-05-21 19:30:20 +01:00
_alpine_3_23.Dockerfile test: bake BATS libraries into test images at build time 2026-05-21 19:30:20 +01:00
_alpine_3_24.Dockerfile Include alpine 3.24 in tests 2026-06-10 20:30:07 +02:00
_centos_9.Dockerfile Add diffutils to RPM dependencies and CentOS test images 2026-10-17 11:55:20 +01:00
_centos_10.Dockerfile Add diffutils to RPM dependencies and CentOS test images 2026-10-17 11:55:20 +01:00
_debian_12.Dockerfile test: bake BATS libraries into test images at build time 2026-05-21 19:30:20 +01:00
_debian_13.Dockerfile test: bake BATS libraries into test images at build time 2026-05-21 19:30:20 +01:00
_fedora_40.Dockerfile test: bake BATS libraries into test images at build time 2026-05-21 19:30:20 +01:00
_fedora_41.Dockerfile test: bake BATS libraries into test images at build time 2026-05-21 19:30:20 +01:00
_fedora_42.Dockerfile test: bake BATS libraries into test images at build time 2026-05-21 19:30:20 +01:00
_fedora_43.Dockerfile test: bake BATS libraries into test images at build time 2026-05-21 19:30:20 +01:00
_fedora_44.Dockerfile replace tox with BATS for new OSes 2026-05-21 22:29:28 +02:00
_fedora_45.Dockerfile Add Fedora 45 to tests 2026-11-03 21:08:38 +01:00
_ubuntu_20.Dockerfile Keep Ubuntu 20.04 in the CI distro matrix 2026-10-09 20:36:16 +02:00
_ubuntu_22.Dockerfile test: bake BATS libraries into test images at build time 2026-05-21 19:30:20 +01:00
_ubuntu_24.Dockerfile test: bake BATS libraries into test images at build time 2026-05-21 19:30:20 +01:00
_ubuntu_26.Dockerfile replace tox with BATS for new OSes 2026-05-21 22:29:28 +02:00
bats_helper.bash Fix shellcheck wrning 2026-06-01 19:30:57 +02:00
README.md Allow running the test suite using podman 2026-11-03 22:15:39 +01:00
run.sh Allow running the test suite using podman 2026-11-03 22:15:39 +01:00
test_automated_install.bats Extract the v6.4.3 logrotate reference with awk in the test 2026-10-17 11:27:56 +02:00
test_fresh_install.bats fix: only trust git repositories the pihole user cannot modify 2026-10-15 19:48:02 +01:00
test_gravity.bats Expect no sample of non-domain entries for a local list 2026-10-18 16:38:20 +02:00
test_installer_ftl.bats Move on_failure_hook to helper file 2026-06-01 19:30:57 +02:00
test_logflush.bats use setpriv for dropping from root to pihole 2026-11-03 13:25:42 +01:00
test_network.bats Move on_failure_hook to helper file 2026-06-01 19:30:57 +02:00
test_selinux.bats Move on_failure_hook to helper file 2026-06-01 19:30:57 +02:00
test_symlink_safety.bats Merge branch 'development' into fix/debug-redact-secrets 2026-11-11 17:31:20 +00:00
test_utils.bats Test getFTLPID() and the logrotate migration 2026-10-17 11:18:37 +02:00

Recommended way to run tests

The test suite is implemented with BATS and runs inside distro-specific OCI containers.

Requirements

  • Docker (with buildx support) or Podman
  • Bash shell

Run tests

From the repository root, run:

bash test/run.sh --distro debian_12

test/run.sh will:

  • Build the distro test image from test/_<distro>.Dockerfile
  • Run the mock/function BATS suite in a fresh container
  • Run the fresh-install BATS suite in a separate fresh container

Available distros

If you are unsure which distro names are valid, run:

bash test/run.sh --help

The help output includes the current list of supported distros.

Optional: override BATS library versions

test/run.sh accepts optional environment variable overrides when building test images:

  • BATS_CORE_VER
  • BATS_SUPPORT_VER
  • BATS_ASSERT_VER
  • BATS_MOCK_VER
  • BATS_FILE_VER

Example:

BATS_CORE_VER=v1.14.0 DISTRO=debian_12 bash test/run.sh