aya-rs / aya

Aya is an eBPF library for the Rust programming language, built with a focus on developer experience and operability.
https://aya-rs.dev/book/
Apache License 2.0
3.25k stars 290 forks source link

integration-tests: Don't use lo interface for XDP, create some veths instead #422

Open vadorovsky opened 2 years ago

vadorovsky commented 2 years ago

Currently, integration tests are attaching XDP programs to lo inteface:

https://github.com/aya-rs/aya/blob/f3262e87bd6ff895537df47fcf5d17c598e564cc/test/integration-test/src/tests/load.rs#L24

That's not a good approach, it's too intrusive, especially if the test fails or if for some reason the XDP program doesn't get unloaded. lo, as well as any already existing NICs, shouldn't be touched.

To test XDP, we should rather create some new, fake veth interfaces, which then we remove after running a test. Such interfaces should be also safe to remove manually if anything goes wrong with cleaning up after the test.

dave-tucker commented 2 years ago

Don't use veths, use dummy interfaces. ip link add dummy0 type dummy

bboyleonp666 commented 1 month ago

Hi, I have gone through the previous PRs and it seems the pain point is that building up a network env is the most annoying part for this issue (although I am not pretty sure). If that's the case, do we consider building up an integration environment using docker compose? By doing so, we can leverage the network settings to handle this issue.