1
0
mirror of https://github.com/containers/netavark.git synced 2026-02-05 06:45:56 +01:00
Files
netavark/test/README.md
Paul Holzinger 1ffe6bd1d0 Add netavark integration tests
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>
2021-12-06 18:17:34 +01:00

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