From 19245dd1e0c8e1e007a3b98527e379337d57b49a Mon Sep 17 00:00:00 2001 From: Fernando Fernandez Mancera Date: Sat, 27 May 2023 18:24:24 +0200 Subject: tests: extend tests for destroy command 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 Signed-off-by: Pablo Neira Ayuso --- tests/shell/testcases/chains/0044chain_destroy_0 | 7 +++++++ tests/shell/testcases/chains/0045chain_destroy_0 | 8 ++++++++ tests/shell/testcases/chains/dumps/0044chain_destroy_0.nft | 2 ++ tests/shell/testcases/chains/dumps/0045chain_destroy_0.nft | 2 ++ tests/shell/testcases/flowtable/0015destroy_0 | 7 +++++++ tests/shell/testcases/flowtable/0016destroy_0 | 6 ++++++ tests/shell/testcases/flowtable/dumps/0015destroy_0.nft | 2 ++ tests/shell/testcases/flowtable/dumps/0016destroy_0.nft | 2 ++ tests/shell/testcases/maps/0014destroy_0 | 8 ++++++++ tests/shell/testcases/maps/0015destroy_0 | 7 +++++++ tests/shell/testcases/maps/dumps/0014destroy_0.nft | 2 ++ tests/shell/testcases/maps/dumps/0015destroy_0.nft | 2 ++ tests/shell/testcases/rule_management/0011destroy_0 | 8 -------- tests/shell/testcases/rule_management/0013destroy_0 | 8 ++++++++ tests/shell/testcases/rule_management/dumps/0011destroy_0.nft | 4 ---- tests/shell/testcases/rule_management/dumps/0013destroy_0 | 4 ++++ tests/shell/testcases/sets/0072destroy_0 | 8 ++++++++ tests/shell/testcases/sets/0073destroy_0 | 7 +++++++ tests/shell/testcases/sets/dumps/0072destroy_0.nft | 2 ++ tests/shell/testcases/sets/dumps/0073destroy_0.nft | 2 ++ 20 files changed, 86 insertions(+), 12 deletions(-) create mode 100755 tests/shell/testcases/chains/0044chain_destroy_0 create mode 100755 tests/shell/testcases/chains/0045chain_destroy_0 create mode 100644 tests/shell/testcases/chains/dumps/0044chain_destroy_0.nft create mode 100644 tests/shell/testcases/chains/dumps/0045chain_destroy_0.nft create mode 100755 tests/shell/testcases/flowtable/0015destroy_0 create mode 100755 tests/shell/testcases/flowtable/0016destroy_0 create mode 100644 tests/shell/testcases/flowtable/dumps/0015destroy_0.nft create mode 100644 tests/shell/testcases/flowtable/dumps/0016destroy_0.nft create mode 100755 tests/shell/testcases/maps/0014destroy_0 create mode 100755 tests/shell/testcases/maps/0015destroy_0 create mode 100644 tests/shell/testcases/maps/dumps/0014destroy_0.nft create mode 100644 tests/shell/testcases/maps/dumps/0015destroy_0.nft delete mode 100755 tests/shell/testcases/rule_management/0011destroy_0 create mode 100755 tests/shell/testcases/rule_management/0013destroy_0 delete mode 100644 tests/shell/testcases/rule_management/dumps/0011destroy_0.nft create mode 100644 tests/shell/testcases/rule_management/dumps/0013destroy_0 create mode 100755 tests/shell/testcases/sets/0072destroy_0 create mode 100755 tests/shell/testcases/sets/0073destroy_0 create mode 100644 tests/shell/testcases/sets/dumps/0072destroy_0.nft create mode 100644 tests/shell/testcases/sets/dumps/0073destroy_0.nft (limited to 'tests/shell/testcases') diff --git a/tests/shell/testcases/chains/0044chain_destroy_0 b/tests/shell/testcases/chains/0044chain_destroy_0 new file mode 100755 index 00000000..070021cf --- /dev/null +++ b/tests/shell/testcases/chains/0044chain_destroy_0 @@ -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 index 00000000..b356f8f8 --- /dev/null +++ b/tests/shell/testcases/chains/0045chain_destroy_0 @@ -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 index 00000000..985768ba --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0044chain_destroy_0.nft @@ -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 index 00000000..985768ba --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0045chain_destroy_0.nft @@ -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 index 00000000..4828d818 --- /dev/null +++ b/tests/shell/testcases/flowtable/0015destroy_0 @@ -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 index 00000000..ce23c753 --- /dev/null +++ b/tests/shell/testcases/flowtable/0016destroy_0 @@ -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 index 00000000..985768ba --- /dev/null +++ b/tests/shell/testcases/flowtable/dumps/0015destroy_0.nft @@ -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 index 00000000..985768ba --- /dev/null +++ b/tests/shell/testcases/flowtable/dumps/0016destroy_0.nft @@ -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 index 00000000..b769276d --- /dev/null +++ b/tests/shell/testcases/maps/0014destroy_0 @@ -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 index 00000000..abad4d57 --- /dev/null +++ b/tests/shell/testcases/maps/0015destroy_0 @@ -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 index 00000000..5d4d2caf --- /dev/null +++ b/tests/shell/testcases/maps/dumps/0014destroy_0.nft @@ -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 index 00000000..5d4d2caf --- /dev/null +++ b/tests/shell/testcases/maps/dumps/0015destroy_0.nft @@ -0,0 +1,2 @@ +table ip x { +} diff --git a/tests/shell/testcases/rule_management/0011destroy_0 b/tests/shell/testcases/rule_management/0011destroy_0 deleted file mode 100755 index 895c24a4..00000000 --- a/tests/shell/testcases/rule_management/0011destroy_0 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -e -$NFT add table t -$NFT add chain t c -$NFT insert rule t c accept # should have handle 2 - -$NFT destroy rule t c handle 2 diff --git a/tests/shell/testcases/rule_management/0013destroy_0 b/tests/shell/testcases/rule_management/0013destroy_0 new file mode 100755 index 00000000..895c24a4 --- /dev/null +++ b/tests/shell/testcases/rule_management/0013destroy_0 @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e +$NFT add table t +$NFT add chain t c +$NFT insert rule t c accept # should have handle 2 + +$NFT destroy rule t c handle 2 diff --git a/tests/shell/testcases/rule_management/dumps/0011destroy_0.nft b/tests/shell/testcases/rule_management/dumps/0011destroy_0.nft deleted file mode 100644 index 1e0d1d60..00000000 --- a/tests/shell/testcases/rule_management/dumps/0011destroy_0.nft +++ /dev/null @@ -1,4 +0,0 @@ -table ip t { - chain c { - } -} diff --git a/tests/shell/testcases/rule_management/dumps/0013destroy_0 b/tests/shell/testcases/rule_management/dumps/0013destroy_0 new file mode 100644 index 00000000..1e0d1d60 --- /dev/null +++ b/tests/shell/testcases/rule_management/dumps/0013destroy_0 @@ -0,0 +1,4 @@ +table ip t { + chain c { + } +} diff --git a/tests/shell/testcases/sets/0072destroy_0 b/tests/shell/testcases/sets/0072destroy_0 new file mode 100755 index 00000000..c9cf9ff7 --- /dev/null +++ b/tests/shell/testcases/sets/0072destroy_0 @@ -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 index 00000000..a9d65a55 --- /dev/null +++ b/tests/shell/testcases/sets/0073destroy_0 @@ -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 index 00000000..5d4d2caf --- /dev/null +++ b/tests/shell/testcases/sets/dumps/0072destroy_0.nft @@ -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 index 00000000..5d4d2caf --- /dev/null +++ b/tests/shell/testcases/sets/dumps/0073destroy_0.nft @@ -0,0 +1,2 @@ +table ip x { +} -- cgit v1.2.3