Add tests for areas of container behaviour not previously exercised:
- crond is running (not just that the crontab file is valid)
- Logrotate config is installed at /etc/pihole/logrotate
- Default DNS upstreams (8.8.8.8/8.8.4.4) applied when none configured
- Web interface accessible at /admin/ (default port and custom port)
- /pihole.docker.tag build metadata file is present
- macvendor.db is present and configured in FTL
- FTL is running as the pihole user (validates DNSMASQ_USER default)
- Capabilities are applied to pihole-FTL (validates fix_capabilities)
- WEBPASSWORD_FILE reads the web password from a Docker secret
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
Container creation, waiting, and teardown previously lived in run.sh
and were passed to test_suite.bats via exported environment variables.
This scattered container lifecycle between two files and required
custom inline logic for tests that needed their own container.
Replace test_suite.bats with two focused files, each owning their
container via setup_file/teardown_file:
- test_default.bats: plain container; covers FTL binary, cron,
password generation, and graceful shutdown (run last, sequentially)
- test_env_vars.bats: custom UID/GID, FTLCONF_ vars, ADDITIONAL_PACKAGES,
and TAIL_FTL_LOG=0 all exercised in a single container
Extract start_container and wait_for_log into test/helpers.sh, which
each .bats file loads directly. run.sh now only builds the image,
installs BATS, and invokes the test files.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
Building a command string and calling eval is harder to reason about
and requires careful manual quoting. Replacing with a bash array makes
each argument explicit and removes the fragile string substitution
previously used to toggle --no-cache and update the tag value.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add CONTAINER_PACKAGES shared container (ADDITIONAL_PACKAGES=wget)
and a test that verifies the package is installed and on PATH
- Add inline container test for TAIL_FTL_LOG=true, verifying that
FTL log lines tagged [FTL] appear in docker logs output
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously a malformed or unreadable crontab would silently fail,
leaving gravity updates and the update checker permanently disabled
with no indication in the logs. Now logs a clear error message.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the pytest/testinfra/tox test stack with BATS, aligning with
the approach used in the FTL repository.
- Merge build-and-test.yml into build-and-publish.yml; the combined
lint+test job now runs on pull_request via a single bash test/run.sh
call, removing the need for Python/tox in CI
- Replace Python test files with test/run.sh and test/test_suite.bats
- test/run.sh handles image build, BATS install, container lifecycle,
and cleanup via trap in one place
- Containers consolidated from 6 to 2 (CONTAINER_DEFAULT and
CONTAINER_CUSTOM), removing tests that belong to FTL's own suite
- Tests now focus on Docker-specific behaviour: entrypoint, signal
handling, UID/GID mapping, cron setup, and password assignment
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>