Skip to contentSkip to conversation

tests: shell: large set overlap and automerge

PATCH In review Pablo Neira Ayuso 2 participants 4 messages Jun 16, 2022 – Jun 23, 2022 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 tests: shell: large set overlap and automerge

Add a test to validate set overlap and automerge for large set. This test runs nft -f twice to cover for set reload without flush.

---
 .../testcases/sets/overlap_automerge_large_0  | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100755 tests/shell/testcases/sets/overlap_automerge_large_0
tests/shell/testcases/sets/overlap_automerge_large_0 new file +52 -0
new file mode 100755
index 000000000000..578eeda81831
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+set -e
+
+RULESET="table inet x {
+        set y {
+                type ipv4_addr
+                flags interval
+        }
+}"
+
+tmpfile=$(mktemp)
+
+for ((i=1;i<255;i+=2))
+do
+	for ((j=1;j<224;j+=2))
+	do
+		echo "add element inet x y { 10.100.$i.$j }" >> $tmpfile
+	done
+done
+
+$NFT -f - <<< $RULESET
+time $NFT -f $tmpfile
+time $NFT -f $tmpfile
+$NFT flush ruleset
+
+tmpfile2=$(mktemp)
+
+RULESET="table inet x {
+        set y {
+                type ipv4_addr
+                flags interval
+		auto-merge
+        }
+}"
+
+for ((i=1;i<255;i+=2))
+do
+	for ((j=1;j<224;j+=2))
+	do
+		echo "add element inet x y { 10.100.$i.$j }" >> $tmpfile2
+		j=$(($j+1))
+		echo "add element inet x y { 10.100.$i.$j }" >> $tmpfile2
+	done
+done
+
+$NFT -f - <<< $RULESET
+time $NFT -f $tmpfile2
+time $NFT -f $tmpfile2
+
+rm -f $tmpfile
+rm -f $tmpfile2
Signature · 1 line
2.30.2
reviewer
#1 lore raw
Quoted 2 lines · Pablo Neira Ayuso

Add a test to validate set overlap and automerge for large set. This test runs nft -f twice to cover for set reload without flush.

I had this in mind as well, but didn't like to hard-code any thresholds. Your test is useful only for manual result review and will always pass, therefore will only increase testsuite run time without any benefit.

Cheers, Phil

author maintainer
#2 lore raw
Quoted 7 lines · Phil Sutter
Quoted 2 lines · Pablo Neira Ayuso

Add a test to validate set overlap and automerge for large set. This test runs nft -f twice to cover for set reload without flush.

I had this in mind as well, but didn't like to hard-code any thresholds. Your test is useful only for manual result review and will always pass, therefore will only increase testsuite run time without any benefit.

Yes, I run them manually often and it won't work for a robot, unless time is printed somewhere and the robot identifies an anomaly there.

I can remove it if you like.

reviewer
#3 lore raw
Quoted 5 lines · Pablo Neira Ayuso
Quoted 4 lines · Phil Sutter
Quoted 2 lines · Pablo Neira Ayuso

Add a test to validate set overlap and automerge for large set. This test runs nft -f twice to cover for set reload without flush.

Quoted 8 lines
Quoted 3 lines

I had this in mind as well, but didn't like to hard-code any thresholds. Your test is useful only for manual result review and will always pass, therefore will only increase testsuite run time without any benefit.

Yes, I run them manually often and it won't work for a robot, unless time is printed somewhere and the robot identifies an anomaly there.

I can remove it if you like.

Just don't push it? :)