tests: shell: delete useless stderr output in testcase
PATCH 1/3 tests: shell: delete useless stderr output in testcase
From: Arturo Borrero Gonzalez <[email protected]>
This stderr output is expected.
Signed-off-by Arturo Borrero Gonzalez <[email protected]>
--- tests/shell/testcases/transactions/0014chain_1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/shell/testcases/transactions/0014chain_1 +1 -1
@@ -16,5 +16,5 @@ delete chain x y delete chain x y" echo "$RULESET" > $tmpfile -$NFT -f $tmpfile +$NFT -f $tmpfile 2>/dev/null echo "E: allowing double-removal of chain" >&2
PATCH 2/3 tests: shell: introduce the cache testcases directory
From: Arturo Borrero Gonzalez <[email protected]>
This directory is for testcases related to the nft cache.
Signed-off-by Arturo Borrero Gonzalez <[email protected]>
--- tests/shell/testcases/cache/0001_cache_handling_0 | 29 +++++++++++++++++++++ tests/shell/testcases/sets/cache_handling_0 | 29 --------------------- 2 files changed, 29 insertions(+), 29 deletions(-) create mode 100755 tests/shell/testcases/cache/0001_cache_handling_0 delete mode 100755 tests/shell/testcases/sets/cache_handling_0
tests/shell/testcases/cache/0001_cache_handling_0 new file +29 -0
@@ -0,0 +1,29 @@ +#!/bin/bash + +tmpfile=$(mktemp) +if [ ! -w $tmpfile ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +trap "rm -rf $tmpfile" EXIT # cleanup if aborted + +echo " +table inet test { + set test { + type ipv4_addr + elements = { 1.1.1.1} + } + + chain test { + ip saddr @test counter accept + ip daddr { 2.2.2.2} counter accept + } +}" > $tmpfile + +set -e + +$NFT -f $tmpfile +$NFT delete rule inet test test handle 2 +$NFT delete set inet test test +$NFT -f $tmpfile
tests/shell/testcases/sets/cache_handling_0 deleted +0 -29
@@ -1,29 +0,0 @@ -#!/bin/bash - -tmpfile=$(mktemp) -if [ ! -w $tmpfile ] ; then - echo "Failed to create tmp file" >&2 - exit 0 -fi - -trap "rm -rf $tmpfile" EXIT # cleanup if aborted - -echo " -table inet test { - set test { - type ipv4_addr - elements = { 1.1.1.1} - } - - chain test { - ip saddr @test counter accept - ip daddr { 2.2.2.2} counter accept - } -}" > $tmpfile - -set -e - -$NFT -f $tmpfile -$NFT delete rule inet test test handle 2 -$NFT delete set inet test test -$NFT -f $tmpfile
PATCH 3/3 tests: shell: add a new testcase for ruleset loading bug
In reply to Arturo Borrero GonzalezFrom: Arturo Borrero Gonzalez <[email protected]>
There seems to be a bug that prevent loading a ruleset twice in a row if the ruleset contains sets with intervals. This seems related to the nft cache.
By the time of this commit, the bug is not fixed yet.
Signed-off-by Arturo Borrero Gonzalez <[email protected]>
--- tests/shell/testcases/cache/0002_interval_0 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 tests/shell/testcases/cache/0002_interval_0
tests/shell/testcases/cache/0002_interval_0 new file +27 -0
@@ -0,0 +1,27 @@ +#!/bin/bash + +# This testcase checks that we can load a ruleset twice in a row. +# bug --> Error: interval overlaps with an existing one + +set -e + +tmpfile=$(mktemp) +if [ ! -w $tmpfile ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +trap "rm -rf $tmpfile" EXIT # cleanup if aborted + +RULESET="flush ruleset +table inet t { + set s { type ipv4_addr; flags interval; } +} + +add element inet t s { + 192.168.0.1/24, +}" + +echo "$RULESET" > $tmpfile +$NFT -f $tmpfile +$NFT -f $tmpfile
Pablo Neira Ayuso
maintainerSeries applied, thanks Arturo.