summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/optionals
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2024-02-08 14:30:17 +0100
committerPhil Sutter <phil@nwl.cc>2024-02-08 18:28:01 +0100
commit624b034b83a66ec2263314db9dc62ac06b1ae7e7 (patch)
tree3d162db5931e09ef7e36e9df0003c44bd1d4e617 /tests/shell/testcases/optionals
parentd8f2124ffe1965629d0d47ad22a27e36de279c43 (diff)
tests: shell: Pretty-print all *.json-nft dumps
The problem with single line output as produced by 'nft -j list ruleset' is its incompatibility to unified diff format as any change in this single line will produce a diff which contains the old and new lines in total. This is not just unreadable but will blow up patches which may exceed mailinglists' mail size limits. Convert them all at once by feeding their contents to tests/shell/helpers/json-pretty.sh. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tests/shell/testcases/optionals')
-rw-r--r--tests/shell/testcases/optionals/dumps/comments_0.json-nft59
-rw-r--r--tests/shell/testcases/optionals/dumps/comments_chain_0.json-nft28
-rw-r--r--tests/shell/testcases/optionals/dumps/comments_handles_0.json-nft59
-rw-r--r--tests/shell/testcases/optionals/dumps/comments_objects_dup_0.json-nft12
-rw-r--r--tests/shell/testcases/optionals/dumps/comments_table_0.json-nft20
-rw-r--r--tests/shell/testcases/optionals/dumps/delete_object_handles_0.json-nft68
-rw-r--r--tests/shell/testcases/optionals/dumps/handles_0.json-nft58
-rw-r--r--tests/shell/testcases/optionals/dumps/handles_1.json-nft58
-rw-r--r--tests/shell/testcases/optionals/dumps/log_prefix_0.json-nft53
-rw-r--r--tests/shell/testcases/optionals/dumps/update_object_handles_0.json-nft40
10 files changed, 445 insertions, 10 deletions
diff --git a/tests/shell/testcases/optionals/dumps/comments_0.json-nft b/tests/shell/testcases/optionals/dumps/comments_0.json-nft
index 53d33b70..aef4b3e4 100644
--- a/tests/shell/testcases/optionals/dumps/comments_0.json-nft
+++ b/tests/shell/testcases/optionals/dumps/comments_0.json-nft
@@ -1 +1,58 @@
-{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "test", "handle": 0}}, {"chain": {"family": "ip", "table": "test", "name": "test", "handle": 0}}, {"rule": {"family": "ip", "table": "test", "chain": "test", "handle": 0, "comment": "test_comment", "expr": [{"match": {"op": "==", "left": {"payload": {"protocol": "tcp", "field": "dport"}}, "right": 22}}, {"counter": {"packets": 0, "bytes": 0}}, {"accept": null}]}}]}
+{
+ "nftables": [
+ {
+ "metainfo": {
+ "version": "VERSION",
+ "release_name": "RELEASE_NAME",
+ "json_schema_version": 1
+ }
+ },
+ {
+ "table": {
+ "family": "ip",
+ "name": "test",
+ "handle": 0
+ }
+ },
+ {
+ "chain": {
+ "family": "ip",
+ "table": "test",
+ "name": "test",
+ "handle": 0
+ }
+ },
+ {
+ "rule": {
+ "family": "ip",
+ "table": "test",
+ "chain": "test",
+ "handle": 0,
+ "comment": "test_comment",
+ "expr": [
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "payload": {
+ "protocol": "tcp",
+ "field": "dport"
+ }
+ },
+ "right": 22
+ }
+ },
+ {
+ "counter": {
+ "packets": 0,
+ "bytes": 0
+ }
+ },
+ {
+ "accept": null
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/shell/testcases/optionals/dumps/comments_chain_0.json-nft b/tests/shell/testcases/optionals/dumps/comments_chain_0.json-nft
index c57ab0be..4c752e80 100644
--- a/tests/shell/testcases/optionals/dumps/comments_chain_0.json-nft
+++ b/tests/shell/testcases/optionals/dumps/comments_chain_0.json-nft
@@ -1 +1,27 @@
-{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "test_table", "handle": 0}}, {"chain": {"family": "ip", "table": "test_table", "name": "test_chain", "handle": 0, "comment": "test"}}]}
+{
+ "nftables": [
+ {
+ "metainfo": {
+ "version": "VERSION",
+ "release_name": "RELEASE_NAME",
+ "json_schema_version": 1
+ }
+ },
+ {
+ "table": {
+ "family": "ip",
+ "name": "test_table",
+ "handle": 0
+ }
+ },
+ {
+ "chain": {
+ "family": "ip",
+ "table": "test_table",
+ "name": "test_chain",
+ "handle": 0,
+ "comment": "test"
+ }
+ }
+ ]
+}
diff --git a/tests/shell/testcases/optionals/dumps/comments_handles_0.json-nft b/tests/shell/testcases/optionals/dumps/comments_handles_0.json-nft
index 53d33b70..aef4b3e4 100644
--- a/tests/shell/testcases/optionals/dumps/comments_handles_0.json-nft
+++ b/tests/shell/testcases/optionals/dumps/comments_handles_0.json-nft
@@ -1 +1,58 @@
-{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "test", "handle": 0}}, {"chain": {"family": "ip", "table": "test", "name": "test", "handle": 0}}, {"rule": {"family": "ip", "table": "test", "chain": "test", "handle": 0, "comment": "test_comment", "expr": [{"match": {"op": "==", "left": {"payload": {"protocol": "tcp", "field": "dport"}}, "right": 22}}, {"counter": {"packets": 0, "bytes": 0}}, {"accept": null}]}}]}
+{
+ "nftables": [
+ {
+ "metainfo": {
+ "version": "VERSION",
+ "release_name": "RELEASE_NAME",
+ "json_schema_version": 1
+ }
+ },
+ {
+ "table": {
+ "family": "ip",
+ "name": "test",
+ "handle": 0
+ }
+ },
+ {
+ "chain": {
+ "family": "ip",
+ "table": "test",
+ "name": "test",
+ "handle": 0
+ }
+ },
+ {
+ "rule": {
+ "family": "ip",
+ "table": "test",
+ "chain": "test",
+ "handle": 0,
+ "comment": "test_comment",
+ "expr": [
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "payload": {
+ "protocol": "tcp",
+ "field": "dport"
+ }
+ },
+ "right": 22
+ }
+ },
+ {
+ "counter": {
+ "packets": 0,
+ "bytes": 0
+ }
+ },
+ {
+ "accept": null
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/shell/testcases/optionals/dumps/comments_objects_dup_0.json-nft b/tests/shell/testcases/optionals/dumps/comments_objects_dup_0.json-nft
index 0048e6b1..546cc597 100644
--- a/tests/shell/testcases/optionals/dumps/comments_objects_dup_0.json-nft
+++ b/tests/shell/testcases/optionals/dumps/comments_objects_dup_0.json-nft
@@ -1 +1,11 @@
-{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}]}
+{
+ "nftables": [
+ {
+ "metainfo": {
+ "version": "VERSION",
+ "release_name": "RELEASE_NAME",
+ "json_schema_version": 1
+ }
+ }
+ ]
+}
diff --git a/tests/shell/testcases/optionals/dumps/comments_table_0.json-nft b/tests/shell/testcases/optionals/dumps/comments_table_0.json-nft
index 5f3c759d..8512c7de 100644
--- a/tests/shell/testcases/optionals/dumps/comments_table_0.json-nft
+++ b/tests/shell/testcases/optionals/dumps/comments_table_0.json-nft
@@ -1 +1,19 @@
-{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "test", "handle": 0, "comment": "test_comment"}}]}
+{
+ "nftables": [
+ {
+ "metainfo": {
+ "version": "VERSION",
+ "release_name": "RELEASE_NAME",
+ "json_schema_version": 1
+ }
+ },
+ {
+ "table": {
+ "family": "ip",
+ "name": "test",
+ "handle": 0,
+ "comment": "test_comment"
+ }
+ }
+ ]
+}
diff --git a/tests/shell/testcases/optionals/dumps/delete_object_handles_0.json-nft b/tests/shell/testcases/optionals/dumps/delete_object_handles_0.json-nft
index 8961a1e6..583ce528 100644
--- a/tests/shell/testcases/optionals/dumps/delete_object_handles_0.json-nft
+++ b/tests/shell/testcases/optionals/dumps/delete_object_handles_0.json-nft
@@ -1 +1,67 @@
-{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "test-ip", "handle": 0}}, {"quota": {"family": "ip", "name": "https-quota", "table": "test-ip", "handle": 0, "bytes": 26214400, "used": 0, "inv": false}}, {"map": {"family": "ip", "name": "ports", "table": "test-ip", "type": "inet_service", "handle": 0, "map": "quota"}}, {"table": {"family": "ip6", "name": "test-ip6", "handle": 0}}, {"quota": {"family": "ip6", "name": "http-quota", "table": "test-ip6", "handle": 0, "bytes": 26214400, "used": 0, "inv": true}}, {"counter": {"family": "ip6", "name": "http-traffic", "table": "test-ip6", "handle": 0, "packets": 0, "bytes": 0}}]}
+{
+ "nftables": [
+ {
+ "metainfo": {
+ "version": "VERSION",
+ "release_name": "RELEASE_NAME",
+ "json_schema_version": 1
+ }
+ },
+ {
+ "table": {
+ "family": "ip",
+ "name": "test-ip",
+ "handle": 0
+ }
+ },
+ {
+ "quota": {
+ "family": "ip",
+ "name": "https-quota",
+ "table": "test-ip",
+ "handle": 0,
+ "bytes": 26214400,
+ "used": 0,
+ "inv": false
+ }
+ },
+ {
+ "map": {
+ "family": "ip",
+ "name": "ports",
+ "table": "test-ip",
+ "type": "inet_service",
+ "handle": 0,
+ "map": "quota"
+ }
+ },
+ {
+ "table": {
+ "family": "ip6",
+ "name": "test-ip6",
+ "handle": 0
+ }
+ },
+ {
+ "quota": {
+ "family": "ip6",
+ "name": "http-quota",
+ "table": "test-ip6",
+ "handle": 0,
+ "bytes": 26214400,
+ "used": 0,
+ "inv": true
+ }
+ },
+ {
+ "counter": {
+ "family": "ip6",
+ "name": "http-traffic",
+ "table": "test-ip6",
+ "handle": 0,
+ "packets": 0,
+ "bytes": 0
+ }
+ }
+ ]
+}
diff --git a/tests/shell/testcases/optionals/dumps/handles_0.json-nft b/tests/shell/testcases/optionals/dumps/handles_0.json-nft
index bd3fd867..ff06af30 100644
--- a/tests/shell/testcases/optionals/dumps/handles_0.json-nft
+++ b/tests/shell/testcases/optionals/dumps/handles_0.json-nft
@@ -1 +1,57 @@
-{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "test", "handle": 0}}, {"chain": {"family": "ip", "table": "test", "name": "test", "handle": 0}}, {"rule": {"family": "ip", "table": "test", "chain": "test", "handle": 0, "expr": [{"match": {"op": "==", "left": {"payload": {"protocol": "tcp", "field": "dport"}}, "right": 22}}, {"counter": {"packets": 0, "bytes": 0}}, {"accept": null}]}}]}
+{
+ "nftables": [
+ {
+ "metainfo": {
+ "version": "VERSION",
+ "release_name": "RELEASE_NAME",
+ "json_schema_version": 1
+ }
+ },
+ {
+ "table": {
+ "family": "ip",
+ "name": "test",
+ "handle": 0
+ }
+ },
+ {
+ "chain": {
+ "family": "ip",
+ "table": "test",
+ "name": "test",
+ "handle": 0
+ }
+ },
+ {
+ "rule": {
+ "family": "ip",
+ "table": "test",
+ "chain": "test",
+ "handle": 0,
+ "expr": [
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "payload": {
+ "protocol": "tcp",
+ "field": "dport"
+ }
+ },
+ "right": 22
+ }
+ },
+ {
+ "counter": {
+ "packets": 0,
+ "bytes": 0
+ }
+ },
+ {
+ "accept": null
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/shell/testcases/optionals/dumps/handles_1.json-nft b/tests/shell/testcases/optionals/dumps/handles_1.json-nft
index bd3fd867..ff06af30 100644
--- a/tests/shell/testcases/optionals/dumps/handles_1.json-nft
+++ b/tests/shell/testcases/optionals/dumps/handles_1.json-nft
@@ -1 +1,57 @@
-{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "test", "handle": 0}}, {"chain": {"family": "ip", "table": "test", "name": "test", "handle": 0}}, {"rule": {"family": "ip", "table": "test", "chain": "test", "handle": 0, "expr": [{"match": {"op": "==", "left": {"payload": {"protocol": "tcp", "field": "dport"}}, "right": 22}}, {"counter": {"packets": 0, "bytes": 0}}, {"accept": null}]}}]}
+{
+ "nftables": [
+ {
+ "metainfo": {
+ "version": "VERSION",
+ "release_name": "RELEASE_NAME",
+ "json_schema_version": 1
+ }
+ },
+ {
+ "table": {
+ "family": "ip",
+ "name": "test",
+ "handle": 0
+ }
+ },
+ {
+ "chain": {
+ "family": "ip",
+ "table": "test",
+ "name": "test",
+ "handle": 0
+ }
+ },
+ {
+ "rule": {
+ "family": "ip",
+ "table": "test",
+ "chain": "test",
+ "handle": 0,
+ "expr": [
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "payload": {
+ "protocol": "tcp",
+ "field": "dport"
+ }
+ },
+ "right": 22
+ }
+ },
+ {
+ "counter": {
+ "packets": 0,
+ "bytes": 0
+ }
+ },
+ {
+ "accept": null
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/shell/testcases/optionals/dumps/log_prefix_0.json-nft b/tests/shell/testcases/optionals/dumps/log_prefix_0.json-nft
index 86b5be26..161a58d4 100644
--- a/tests/shell/testcases/optionals/dumps/log_prefix_0.json-nft
+++ b/tests/shell/testcases/optionals/dumps/log_prefix_0.json-nft
@@ -1 +1,52 @@
-{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "x", "handle": 0}}, {"chain": {"family": "ip", "table": "x", "name": "y", "handle": 0}}, {"rule": {"family": "ip", "table": "x", "chain": "y", "handle": 0, "expr": [{"match": {"op": "in", "left": {"ct": {"key": "state"}}, "right": "invalid"}}, {"log": {"prefix": "invalid state match, logging:"}}]}}]}
+{
+ "nftables": [
+ {
+ "metainfo": {
+ "version": "VERSION",
+ "release_name": "RELEASE_NAME",
+ "json_schema_version": 1
+ }
+ },
+ {
+ "table": {
+ "family": "ip",
+ "name": "x",
+ "handle": 0
+ }
+ },
+ {
+ "chain": {
+ "family": "ip",
+ "table": "x",
+ "name": "y",
+ "handle": 0
+ }
+ },
+ {
+ "rule": {
+ "family": "ip",
+ "table": "x",
+ "chain": "y",
+ "handle": 0,
+ "expr": [
+ {
+ "match": {
+ "op": "in",
+ "left": {
+ "ct": {
+ "key": "state"
+ }
+ },
+ "right": "invalid"
+ }
+ },
+ {
+ "log": {
+ "prefix": "invalid state match, logging:"
+ }
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/shell/testcases/optionals/dumps/update_object_handles_0.json-nft b/tests/shell/testcases/optionals/dumps/update_object_handles_0.json-nft
index 4ba1692a..ba78f8d7 100644
--- a/tests/shell/testcases/optionals/dumps/update_object_handles_0.json-nft
+++ b/tests/shell/testcases/optionals/dumps/update_object_handles_0.json-nft
@@ -1 +1,39 @@
-{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "test-ip", "handle": 0}}, {"counter": {"family": "ip", "name": "traffic-counter", "table": "test-ip", "handle": 0, "packets": 0, "bytes": 0}}, {"quota": {"family": "ip", "name": "traffic-quota", "table": "test-ip", "handle": 0, "bytes": 52428800, "used": 0, "inv": false}}]}
+{
+ "nftables": [
+ {
+ "metainfo": {
+ "version": "VERSION",
+ "release_name": "RELEASE_NAME",
+ "json_schema_version": 1
+ }
+ },
+ {
+ "table": {
+ "family": "ip",
+ "name": "test-ip",
+ "handle": 0
+ }
+ },
+ {
+ "counter": {
+ "family": "ip",
+ "name": "traffic-counter",
+ "table": "test-ip",
+ "handle": 0,
+ "packets": 0,
+ "bytes": 0
+ }
+ },
+ {
+ "quota": {
+ "family": "ip",
+ "name": "traffic-quota",
+ "table": "test-ip",
+ "handle": 0,
+ "bytes": 52428800,
+ "used": 0,
+ "inv": false
+ }
+ }
+ ]
+}