18 introduced running tests against nft inside network namespaces with a script that manually manages a network namespace to execute cargo test.
FYI, it should be much simpler to just use unshare -n cargo ... to create a new netns here, no need to manage any ip netns "names". You can also do unshare -rn as normal user (assuming unprivileged user namespaces are enabled, which is the default for most distros) so not even a need for sudo.
Because the netns is only tied to the process once the process exits the netns will be gone so you also can skip the clean-up logic as well
_Originally posted by @Luap99 in https://github.com/namib-project/nftables-rs/pull/18#discussion_r1527210554_
The helper_tests could be improved such that each test calls unshare -rn nft as program arg for apply and get ruleset functions.
18 introduced running tests against
nft
inside network namespaces with a script that manually manages a network namespace to executecargo test
.The
helper_tests
could be improved such that each test callsunshare -rn nft
asprogram
arg for apply and get ruleset functions.