Testing: what is proven, and how
How to run everything is in Development and tests. This page explains what each layer shows, what was observed, and what it does not show.
Layers
Diagram source
flowchart TD
A["unit tests: logic with fakes"] --> B["kernel and system tests: real Linux inside namespaces"]
B --> C["end-to-end: the real program under systemd, attacked"]
C --> D["reboot check"]
C --> E["compatibility matrix: Docker, ufw, firewalld"]
A --> F["race detector and fuzzing"]| Layer | Answers | Cannot answer |
|---|---|---|
| unit | is each rule implemented? | does the kernel agree? |
| kernel (namespaces) | do real packets get dropped and ownership checks hold? | does the service work on a real system? |
| end-to-end | does the whole thing work with real sshd, web servers, systemd? | behaviour on other systems |
| reboot | are bans restored? | |
| matrix | does it coexist with other firewall users? | untested versions |
| race | are there unsynchronized memory accesses in tested paths? | paths not exercised |
| fuzz | can random input crash a parser? | wrong but non-crashing results |
Observed results (28 November 2026)
| Check | Result |
|---|---|
| format, vet (Windows, linux/amd64, linux/arm64), module verification | clean |
| all tests as root, with kernel tests: Debian 13, Debian 12, Rocky 9.9, emulated arm64 | 185 passed, 0 skipped, 0 failed on each |
| race detector, Debian 13 | no races |
| parser fuzzing, 90 s | 8.4 million inputs, no failure |
| two builds | identical checksums, statically linked |
| end-to-end | Debian 13 95/95, Debian 12 95/95, Rocky 96/96, arm64 95/95 |
| reboot | 8/8 on all four |
| Docker 26.1.5 (iptables-nft, iptables-legacy), Docker 29.10.1 (nftables) | 23/23 each |
| ufw 0.36.2, firewalld 2.3.1 | 14/14, 13/13 |
The last two code edits before these notes changed only message text. After the final one the unit tests, race detector, Debian 13 end-to-end run and Docker 29 matrix were repeated; the remaining results came from builds one or two edits earlier. Results describe those virtual machines on that date, not your system.
Checking the documentation
When these pages were written (28 November 2026) the commands and recipes in them were run on the Debian 13 test machine, every settings example was parsed by the program's own configuration loader, every diagram was parsed by Mermaid, and every internal link was resolved. These checks are not part of the repository, so they do not rerun on their own: when you change behaviour, update the pages with it.
What the end-to-end script does
test/e2e/e2e.sh, in order. Each line is one or more checks.
| Stage | Checks |
|---|---|
| install, init | unit file valid; init reports, allowlists the live SSH client, writes a short config once, changes no firewall state, creates no database |
| observe | service starts and signals readiness; private files; another user cannot control it; five failures recorded but nothing blocked; private source exempt |
| enable | ownership marker; another table untouched; dry-run decision not turned into a ban |
| ban | four failures do nothing, the fifth blocks; other sources unaffected; loopback unaffected; counters move; IPv6 single address |
| forgery | injected user name bans the true source; logger forgeries and a renamed binary ignored |
| restart and stop | blocked immediately after restart; no double counting; blocked while stopped; offline unban and ban; failures while stopped processed later |
| repair | deleted table and flush ruleset repaired |
| modified table | refused and reported; foreign rule kept; resumes when removed |
| expiry | kernel expires with no daemon; history records it |
| allowlist | removes bans; wins inside a range |
| nginx | verified log; probes ban; visitors not banned; rotation; realip refused (and, on RHEL, the format hint) |
| caddy | file and journal; proxy not banned; forged header ignored |
| privacy | traced daemon creates no IP socket |
| vacuum | lost journal position reported |
| disable | table removed; other table intact; not recreated; foreign table refused |
| reboot | service starts at boot; ban restored and effective; uninstall |
The matrix script's checks are listed in Firewall and Docker.
Skipped tests
Without root and IPFENCE_INTEGRATION=1, kernel tests report SKIP with the
reason. On Windows and macOS, Linux-only tests are not compiled at all. A skip or
an absent test is not a pass.
Discipline
Most behaviour was written test first. For the detection parsers and the firewall planning code, tests and implementation were written together without first watching the tests fail. Every bug listed in Design decisions was reproduced by a failing test or check before it was fixed, except where noted there.
Testing a change
Shell commands
gofmt -l . && go vet ./... && GOOS=linux go vet ./... && go test ./...Then, on a disposable Linux machine, the kernel tests; and for anything touching the service, firewall or readers, the end-to-end script.