]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: extend tests for destroy command
authorFernando Fernandez Mancera <ffmancera@riseup.net>
Sat, 27 May 2023 16:24:24 +0000 (18:24 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 1 Jun 2023 19:10:30 +0000 (21:10 +0200)
Extend tests to cover destroy command for chains, flowtables, sets,
maps. In addition rename a destroy command test for rules with a
duplicated number.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
18 files changed:
tests/shell/testcases/chains/0044chain_destroy_0 [new file with mode: 0755]
tests/shell/testcases/chains/0045chain_destroy_0 [new file with mode: 0755]
tests/shell/testcases/chains/dumps/0044chain_destroy_0.nft [new file with mode: 0644]
tests/shell/testcases/chains/dumps/0045chain_destroy_0.nft [new file with mode: 0644]
tests/shell/testcases/flowtable/0015destroy_0 [new file with mode: 0755]
tests/shell/testcases/flowtable/0016destroy_0 [new file with mode: 0755]
tests/shell/testcases/flowtable/dumps/0015destroy_0.nft [new file with mode: 0644]
tests/shell/testcases/flowtable/dumps/0016destroy_0.nft [new file with mode: 0644]
tests/shell/testcases/maps/0014destroy_0 [new file with mode: 0755]
tests/shell/testcases/maps/0015destroy_0 [new file with mode: 0755]
tests/shell/testcases/maps/dumps/0014destroy_0.nft [new file with mode: 0644]
tests/shell/testcases/maps/dumps/0015destroy_0.nft [new file with mode: 0644]
tests/shell/testcases/rule_management/0013destroy_0 [moved from tests/shell/testcases/rule_management/0011destroy_0 with 100% similarity]
tests/shell/testcases/rule_management/dumps/0013destroy_0 [moved from tests/shell/testcases/rule_management/dumps/0011destroy_0.nft with 100% similarity]
tests/shell/testcases/sets/0072destroy_0 [new file with mode: 0755]
tests/shell/testcases/sets/0073destroy_0 [new file with mode: 0755]
tests/shell/testcases/sets/dumps/0072destroy_0.nft [new file with mode: 0644]
tests/shell/testcases/sets/dumps/0073destroy_0.nft [new file with mode: 0644]

diff --git a/tests/shell/testcases/chains/0044chain_destroy_0 b/tests/shell/testcases/chains/0044chain_destroy_0
new file mode 100755 (executable)
index 0000000..070021c
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -e
+
+$NFT add table t
+
+$NFT destroy chain t nochain
diff --git a/tests/shell/testcases/chains/0045chain_destroy_0 b/tests/shell/testcases/chains/0045chain_destroy_0
new file mode 100755 (executable)
index 0000000..b356f8f
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -e
+
+$NFT add table t
+$NFT add chain t c
+
+$NFT destroy chain t c
diff --git a/tests/shell/testcases/chains/dumps/0044chain_destroy_0.nft b/tests/shell/testcases/chains/dumps/0044chain_destroy_0.nft
new file mode 100644 (file)
index 0000000..985768b
--- /dev/null
@@ -0,0 +1,2 @@
+table ip t {
+}
diff --git a/tests/shell/testcases/chains/dumps/0045chain_destroy_0.nft b/tests/shell/testcases/chains/dumps/0045chain_destroy_0.nft
new file mode 100644 (file)
index 0000000..985768b
--- /dev/null
@@ -0,0 +1,2 @@
+table ip t {
+}
diff --git a/tests/shell/testcases/flowtable/0015destroy_0 b/tests/shell/testcases/flowtable/0015destroy_0
new file mode 100755 (executable)
index 0000000..4828d81
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -e
+$NFT add table t
+$NFT add flowtable t f { hook ingress priority 10 \; devices = { lo }\; }
+
+$NFT destroy flowtable t f
diff --git a/tests/shell/testcases/flowtable/0016destroy_0 b/tests/shell/testcases/flowtable/0016destroy_0
new file mode 100755 (executable)
index 0000000..ce23c75
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+set -e
+$NFT add table t
+
+$NFT destroy flowtable t f
diff --git a/tests/shell/testcases/flowtable/dumps/0015destroy_0.nft b/tests/shell/testcases/flowtable/dumps/0015destroy_0.nft
new file mode 100644 (file)
index 0000000..985768b
--- /dev/null
@@ -0,0 +1,2 @@
+table ip t {
+}
diff --git a/tests/shell/testcases/flowtable/dumps/0016destroy_0.nft b/tests/shell/testcases/flowtable/dumps/0016destroy_0.nft
new file mode 100644 (file)
index 0000000..985768b
--- /dev/null
@@ -0,0 +1,2 @@
+table ip t {
+}
diff --git a/tests/shell/testcases/maps/0014destroy_0 b/tests/shell/testcases/maps/0014destroy_0
new file mode 100755 (executable)
index 0000000..b769276
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -e
+
+$NFT add table x
+$NFT add map x y { type ipv4_addr : ipv4_addr\; }
+
+$NFT destroy map x y
diff --git a/tests/shell/testcases/maps/0015destroy_0 b/tests/shell/testcases/maps/0015destroy_0
new file mode 100755 (executable)
index 0000000..abad4d5
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -e
+
+$NFT add table x
+
+$NFT destroy map x nonmap
diff --git a/tests/shell/testcases/maps/dumps/0014destroy_0.nft b/tests/shell/testcases/maps/dumps/0014destroy_0.nft
new file mode 100644 (file)
index 0000000..5d4d2ca
--- /dev/null
@@ -0,0 +1,2 @@
+table ip x {
+}
diff --git a/tests/shell/testcases/maps/dumps/0015destroy_0.nft b/tests/shell/testcases/maps/dumps/0015destroy_0.nft
new file mode 100644 (file)
index 0000000..5d4d2ca
--- /dev/null
@@ -0,0 +1,2 @@
+table ip x {
+}
diff --git a/tests/shell/testcases/sets/0072destroy_0 b/tests/shell/testcases/sets/0072destroy_0
new file mode 100755 (executable)
index 0000000..c9cf9ff
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -e
+
+$NFT add table x
+$NFT add set x s {type ipv4_addr\; size 2\;}
+
+$NFT destroy set x s
diff --git a/tests/shell/testcases/sets/0073destroy_0 b/tests/shell/testcases/sets/0073destroy_0
new file mode 100755 (executable)
index 0000000..a9d65a5
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -e
+
+$NFT add table x
+
+$NFT destroy set x s
diff --git a/tests/shell/testcases/sets/dumps/0072destroy_0.nft b/tests/shell/testcases/sets/dumps/0072destroy_0.nft
new file mode 100644 (file)
index 0000000..5d4d2ca
--- /dev/null
@@ -0,0 +1,2 @@
+table ip x {
+}
diff --git a/tests/shell/testcases/sets/dumps/0073destroy_0.nft b/tests/shell/testcases/sets/dumps/0073destroy_0.nft
new file mode 100644 (file)
index 0000000..5d4d2ca
--- /dev/null
@@ -0,0 +1,2 @@
+table ip x {
+}