Files
nftables-rs/tests/run_nft_tests.sh
wiegratz ea5ad7b54d add helper tests and setup
adds a flush command to the top of the example ruleset so that nftables rules are applied on a clean state.
adds tests that check args passing to nft with get_current_ruleset and specifying invalid nft binary.
2024-03-16 15:07:50 +00:00

22 lines
353 B
Bash
Executable File

#!/bin/bash
NETNS=nft-$(cat /proc/sys/kernel/random/uuid)
RET=0
function nsexec {
ip netns exec $NETNS $@
}
function cleanup {
ip netns delete "$NETNS"
exit $RET
}
trap cleanup EXIT
# create net namespace
(ip netns ls | grep -Fx "$NETNS" 2>/dev/null) || ip netns add "$NETNS"
nft --version;
nsexec cargo test --verbose -- --ignored $@
RET=$?