Skip to contentSkip to conversation

tests: shell: Add missing feature tests to packetpath tests

PATCH In review Phil Sutter 1 participant 2 messages Oct 20 – Oct 21 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 tests: shell: Add missing feature tests to packetpath tests

Test system may lack conntrack-tools, add a feature test covering it. Also add missing socat requirement where needed.

Fixes e1c4f734eae7c ("tests: shell: add packetpath test for nft ct expectation support")
Fixes cbb928d3307c4 ("tests: shell: add packetpath test for timeout policy overrides")
Fixes fcef13a358a07 ("tests: shell: add 'nft ct set zone' test case")
Fixes 3d4ed753c1231 ("tests: shell: Add a test case for FTP helper combined with NAT.")
Fixes 9d8c7bbe82504 ("tests: shell: add packetpath test for nat on loopback")
---
 tests/shell/features/conntrack.sh                  | 4 ++++
 tests/shell/testcases/packetpath/ct_expect         | 1 +
 tests/shell/testcases/packetpath/ct_timeout_policy | 3 +++
 tests/shell/testcases/packetpath/ct_zone_template  | 2 ++
 tests/shell/testcases/packetpath/nat_ftp           | 1 +
 tests/shell/testcases/packetpath/nat_lo            | 2 ++
 6 files changed, 13 insertions(+)
 create mode 100644 tests/shell/features/conntrack.sh
tests/shell/features/conntrack.sh new file +4 -0
new file mode 100644
index 0000000000000..5454c6b0cf0aa
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# check whether conntrack command is available
+conntrack --help >/dev/null 2>&1
tests/shell/testcases/packetpath/ct_expect +1 -0
index cc8f52678cc5f..8b8981bb0b9fe 100755
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 # NFT_TEST_REQUIRES(NFT_TEST_HAVE_socat)
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_conntrack)
 
 . $NFT_TEST_LIBRARY_FILE
 
tests/shell/testcases/packetpath/ct_timeout_policy +3 -0
index 1fefcb52d6c38..13b790bfa5051 100755
@@ -3,6 +3,9 @@
 # Defines ct timeout policies (1s) and verifies they expire for matching flows
 # while non matching flow stay alive >2s
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_socat)
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_conntrack)
+
 . "$NFT_TEST_LIBRARY_FILE"
 
 ip link set lo up
tests/shell/testcases/packetpath/ct_zone_template +2 -0
index c851e8f3280e7..0c8f92ba32e15 100755
@@ -3,6 +3,8 @@
 # Check 'ct zone set 1' actually works, i.e. conntrack is created in
 # the assigned zone.
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_conntrack)
+
 . $NFT_TEST_LIBRARY_FILE
 
 set -e
tests/shell/testcases/packetpath/nat_ftp +1 -0
index bc44ed866125a..cfadd4a6b006e 100755
@@ -3,6 +3,7 @@
 # NFT_TEST_REQUIRES(NFT_TEST_HAVE_tcpdump)
 # NFT_TEST_REQUIRES(NFT_TEST_HAVE_curl)
 # NFT_TEST_REQUIRES(NFT_TEST_HAVE_vsftpd)
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_conntrack)
 
 # modprobe does not work in fake root env
 [ "$NFT_TEST_HAS_REALROOT" != y ] && exit 77
tests/shell/testcases/packetpath/nat_lo +2 -0
index 862aadc82ef13..761c4433afd54 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_socat)
+
 set -e
 
 $NFT -f - <<EOF
Signature · 1 line
2.54.0
author reviewer
#1 lore raw

tests/shell/features/conntrack.sh

Quoted 21 lines · Phil Sutter

Test system may lack conntrack-tools, add a feature test covering it. Also add missing socat requirement where needed.

Fixes e1c4f734eae7c ("tests: shell: add packetpath test for nft ct expectation support")
Fixes cbb928d3307c4 ("tests: shell: add packetpath test for timeout policy overrides")
Fixes fcef13a358a07 ("tests: shell: add 'nft ct set zone' test case")
Fixes 3d4ed753c1231 ("tests: shell: Add a test case for FTP helper combined with NAT.")
Fixes 9d8c7bbe82504 ("tests: shell: add packetpath test for nat on loopback")
---
 tests/shell/features/conntrack.sh                  | 4 ++++
 tests/shell/testcases/packetpath/ct_expect         | 1 +
 tests/shell/testcases/packetpath/ct_timeout_policy | 3 +++
 tests/shell/testcases/packetpath/ct_zone_template  | 2 ++
 tests/shell/testcases/packetpath/nat_ftp           | 1 +
 tests/shell/testcases/packetpath/nat_lo            | 2 ++
 6 files changed, 13 insertions(+)
 create mode 100644 tests/shell/features/conntrack.sh
tests/shell/features/conntrack.sh new file +0 -0
new file mode 100644

Patch applied after fixing for missing execute permissions in the new feature test.