mirror of
https://github.com/containers/netavark.git
synced 2026-02-05 06:45:56 +01:00
Add bats tests for netavark. The test run netavark in completely separate network namespaces to not leak any information on the host. The test runs with the iptables driver but also with the firewalld driver see test/020-firewalld.bats. This is important to cover all firewall driver code paths. You can run the tests with `sudo bats test/` or `podman unshare --rootless-netns bats test/`. Note that the `--rootless-netns` flag is called `--rootless-cni` for podman < v4.0. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
615 B
615 B
Netavark integration test with bats
Running tests
To run the tests locally in your sandbox, you can use one of these methods:
- bats ./test/001-basic.bats # runs just the specified test
- bats ./test/ # runs all
The tests need root privileges to create network namespaces, so you either have to run the test as root or in a user namespace. Because the tests use iptables you also need write access to /run/xtables.lock. You can use podman unshare --rootless-netns bats test/ to run the tests as rootless user.
Requirements
- jq
- iproute2
- iptables
- firewalld
- dbus-daemon
- ncat