Skip to contentSkip to conversation

tests: py: fixes for failing JSON tests

PATCH In review Jeremy Sowden 2 participants 5 messages Oct 11, 2020 – Oct 12, 2020 netfilter

lore
Share & tools
lore
#0 lore raw

cover tests: py: fixes for failing JSON tests

Fixes for a few Python tests with missing or incorrect JSON output.

Jeremy Sowden (3):
tests: py: add missing JSON output for ct test.
tests: py: correct order of set elements in test JSON output.
tests: py: add missing test JSON output for TCP flag tests.

 tests/py/any/ct.t.json          | 15 ++++++
 tests/py/any/ct.t.json.output   | 20 +++----
 tests/py/inet/tcp.t.json        | 93 +++++++++++++++++++++++++++++++++
 tests/py/inet/tcp.t.json.output | 93 +++++++++++++++++++++++++++++++++
 4 files changed, 211 insertions(+), 10 deletions(-)
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/3 tests: py: add missing JSON output for ct test.

Fixes dcec7d57559a ("ct: Add support for the 'id' key")
---
 tests/py/any/ct.t.json | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
tests/py/any/ct.t.json +15 -0
index 59ac27c3055c..c5c15b9c8b94 100644
@@ -1449,6 +1449,21 @@
     }
 ]
 
+# ct id 12345
+[
+    {
+        "match": {
+            "left": {
+                "ct": {
+                    "key": "id"
+                }
+            },
+            "op": "==",
+            "right": 12345
+        }
+    }
+]
+
 # ct zone set mark map { 1 : 1,  2 : 2 }
 [
     {
Signature · 1 line
2.28.0
#2 lore raw

PATCH 2/3 tests: py: correct order of set elements in test JSON output.

In reply to Jeremy Sowden
Fixes 741a06ac15d2 ("mergesort: find base value expression type via recursion")
---
 tests/py/any/ct.t.json.output | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
tests/py/any/ct.t.json.output +10 -10
index aced3817cf49..70ade7e38987 100644
@@ -527,14 +527,14 @@
                 "set": [
                     {
                         "concat": [
-                            "established",
-                            309876276
+                            "new",
+                            305419896
                         ]
                     },
                     {
                         "concat": [
-                            "new",
-                            305419896
+                            "established",
+                            309876276
                         ]
                     },
                     {
@@ -611,23 +611,23 @@
                     [
                         {
                             "concat": [
-                                "established",
-                                2271560481
+                                "new",
+                                305419896
                             ]
                         },
                         {
-                            "accept": null
+                            "drop": null
                         }
                     ],
                     [
                         {
                             "concat": [
-                                "new",
-                                305419896
+                                "established",
+                                2271560481
                             ]
                         },
                         {
-                            "drop": null
+                            "accept": null
                         }
                     ]
                 ]
Signature · 1 line
2.28.0
#3 lore raw

PATCH 3/3 tests: py: add missing test JSON output for TCP flag tests.

In reply to Jeremy Sowden
Fixes 3926a3369bb5 ("mergesort: unbreak listing with binops")
---
 tests/py/inet/tcp.t.json        | 93 +++++++++++++++++++++++++++++++++
 tests/py/inet/tcp.t.json.output | 93 +++++++++++++++++++++++++++++++++
 2 files changed, 186 insertions(+)
tests/py/inet/tcp.t.json +93 -0
index babe59208925..702251828360 100644
@@ -1637,3 +1637,96 @@
     }
 ]
 
+# tcp flags { syn, syn | ack }
+[
+    {
+        "match": {
+            "left": {
+                "payload": {
+                    "field": "flags",
+                    "protocol": "tcp"
+                }
+            },
+            "op": "==",
+            "right": {
+                "set": [
+                    {
+                        "|": [
+                            "syn",
+                            "ack"
+                        ]
+                    },
+                    "syn"
+                ]
+            }
+        }
+    }
+]
+
+# tcp flags & (fin | syn | rst | psh | ack | urg) == { fin, ack, psh | ack, fin | psh | ack }
+[
+    {
+        "match": {
+            "left": {
+                "&": [
+                    {
+                        "payload": {
+                            "field": "flags",
+                            "protocol": "tcp"
+                        }
+                    },
+                    {
+                        "|": [
+                            {
+                                "|": [
+                                    {
+                                        "|": [
+                                            {
+                                                "|": [
+                                                    {
+                                                        "|": [
+                                                            "fin",
+                                                            "syn"
+                                                        ]
+                                                    },
+                                                    "rst"
+                                                ]
+                                            },
+                                            "psh"
+                                        ]
+                                    },
+                                    "ack"
+                                ]
+                            },
+                            "urg"
+                        ]
+                    }
+                ]
+            },
+            "op": "==",
+            "right": {
+                "set": [
+                    {
+                        "|": [
+                            {
+                                "|": [
+                                    "fin",
+                                    "psh"
+                                ]
+                            },
+                            "ack"
+                        ]
+                    },
+                    "fin",
+                    {
+                        "|": [
+                            "psh",
+                            "ack"
+                        ]
+                    },
+                    "ack"
+                ]
+            }
+        }
+    }
+]
tests/py/inet/tcp.t.json.output +93 -0

96 lines not on this page · raw message

Signature · 1 line
2.28.0