This document describes the automated testing that is done for each pull request submitted to bpfman.
Unit testing is executed as part of the
build job by running the
command in the top-level bpfman directory.
Go Example Tests
Tests are run for each of the example programs found in directory
Detailed description TBD
Basic Integration Tests
The full set of basic integration tests are executed by running the following command in the top-level bpfman directory.
Optionally, a subset of the integration tests can be run by adding the "--" and a list of one or more names at the end of the command as shown below.
The integration tests start a
bpfman daemon process, and issue CLI commands
to verify a range of functionality. For XDP and TC programs that are installed
on network interfaces, the integration test code creates a test network
namespace connected to the host by a veth pair on which the programs are
attached. The test code uses the IP subnet 184.108.40.206/24 for the namespace. If
that address conflicts with an existing network on the host, it can be changed
by setting the
BPFMAN_IP_PREFIX environment variable to one that is available as
If bpfman logs are needed to help debug an integration test, set
globally or for a given test.
There are two categories of integration tests: basic and e2e. The basic tests verify basic CLI functionality such as loading, listing, and unloading programs. The e2e tests verify more advanced functionality such as the setting of global variables, priority, and proceed-on by installing the programs, creating traffic if needed, and examining logs to confirm that things are running as expected.
Most eBPF test programs are loaded from container images stored on
quay.io. The source code for
the eBPF test programs can be found in the
directory. These programs are compiled by executing
cargo xtask build-ebpf
--libbpf-dir <libbpf dir>
We also load some tests from local files to test the
bpf directory also contains a script called
can be used to build and push new images to quay if the code is changed.
Images get pushed automatically when code gets merged, however, it's still
useful to be able to push them manually sometimes. For example, when a new test
case requires that both the eBPF and integration code be changed together. It
is also a useful template for new eBPF test code that needs to be pushed.
However, as a word of caution, be aware that existing integration tests will
start using the new programs immediately, so this should only be done if the
modified program is backward compatible.
Kubernetes Integration Tests
Detailed decription TBD