Skip to contentSkip to conversation

tests: shell: Fix for spurious fail in maps/typeof_maps_add_delete

PATCH In review Phil Sutter 2 participants 4 messages Oct 23 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 tests: shell: Fix for spurious fail in maps/typeof_maps_add_delete

Testing on a (probably slow) aarch64 machine yielded dump failure since ruleset listing had '# count 1' appended to map size statement. The 3s delay supposedly wasn't long enough for the element to be reapped after disabling.

The test itself seems to perform all desired ruleset checks though, so just drop the stored dumps to avoid this problem.

Fixes a8260c056a69a ("tests: add dynmap datapath add/delete test case")
---
 .../dumps/typeof_maps_add_delete.json-nft     | 290 ------------------
 .../maps/dumps/typeof_maps_add_delete.nft     |  22 --
 .../maps/dumps/typeof_maps_add_delete.nodump  |   0
 3 files changed, 312 deletions(-)
 delete mode 100644 tests/shell/testcases/maps/dumps/typeof_maps_add_delete.json-nft
 delete mode 100644 tests/shell/testcases/maps/dumps/typeof_maps_add_delete.nft
 create mode 100644 tests/shell/testcases/maps/dumps/typeof_maps_add_delete.nodump
tests/shell/testcases/maps/dumps/typeof_maps_add_delete.json-nft deleted +0 -290
deleted file mode 100644
index 08c10819f1b9c..0000000000000
@@ -1,290 +0,0 @@
-{
-  "nftables": [
-    {
-      "metainfo": {
-        "version": "VERSION",
-        "release_name": "RELEASE_NAME",
-        "json_schema_version": 1
-      }
-    },
-    {
-      "table": {
-        "family": "ip",
-        "name": "dynset",
-        "handle": 0
-      }
-    },
-    {
-      "chain": {
-        "family": "ip",
-        "table": "dynset",
-        "name": "test_ping",
-        "handle": 0
-      }
-    },
-    {
-      "chain": {
-        "family": "ip",
-        "table": "dynset",
-        "name": "input",
-        "handle": 0,
-        "type": "filter",
-        "hook": "input",
-        "prio": 0,
-        "policy": "accept"
-      }
-    },
-    {
-      "map": {
-        "family": "ip",
-        "name": "dynmark",
-        "table": "dynset",
-        "type": {
-          "typeof": {
-            "payload": {
-              "protocol": "ip",
-              "field": "daddr"
-            }
-          }
-        },
-        "handle": 0,
-        "map": "mark",
-        "size": 64,
-        "flags": [
-          "timeout"
-        ],
-        "timeout": 300,
-        "stmt": [
-          {
-            "counter": null
-          }
-        ]
-      }
-    },
-    {
-      "rule": {
-        "family": "ip",
-        "table": "dynset",
-        "chain": "test_ping",
-        "handle": 0,
-        "comment": "should not increment",
-        "expr": [
-          {
-            "match": {
-              "op": "==",
-              "left": {
-                "payload": {
-                  "protocol": "ip",
-                  "field": "saddr"
-                }
-              },
-              "right": "@dynmark"
-            }
-          },
-          {
-            "counter": {
-              "packets": 0,
-              "bytes": 0
-            }
-          }
-        ]
-      }
-    },
-    {
-      "rule": {
-        "family": "ip",
-        "table": "dynset",
-        "chain": "test_ping",
-        "handle": 0,
-        "expr": [
-          {
-            "match": {
-              "op": "!=",
-              "left": {
-                "payload": {
-                  "protocol": "ip",
-                  "field": "saddr"
-                }
-              },
-              "right": "@dynmark"
-            }
-          },
-          {
-            "map": {
-              "op": "add",
-              "elem": {
-                "payload": {
-                  "protocol": "ip",
-                  "field": "saddr"
-                }
-              },
-              "data": 1,
-              "map": "@dynmark"
-            }
-          },
-          {
-            "counter": {
-              "packets": 1,
-              "bytes": 84
-            }
-          }
-        ]
-      }
-    },
-    {
-      "rule": {
-        "family": "ip",
-        "table": "dynset",
-        "chain": "test_ping",
-        "handle": 0,
-        "comment": "should increment",
-        "expr": [
-          {
-            "match": {
-              "op": "==",
-              "left": {
-                "payload": {
-                  "protocol": "ip",
-                  "field": "saddr"
-                }
-              },
-              "right": "@dynmark"
-            }
-          },
-          {
-            "counter": {
-              "packets": 1,
-              "bytes": 84
-            }
-          }
-        ]
-      }
-    },
-    {
-      "rule": {
-        "family": "ip",
-        "table": "dynset",
-        "chain": "test_ping",
-        "handle": 0,
-        "expr": [
-          {
-            "match": {
-              "op": "==",
-              "left": {
-                "payload": {
-                  "protocol": "ip",
-                  "field": "saddr"
-                }
-              },
-              "right": "@dynmark"
-            }
-          },
-          {
-            "map": {
-              "op": "delete",
-              "elem": {
-                "payload": {
-                  "protocol": "ip",
-                  "field": "saddr"
-                }
-              },
-              "data": 1,
-              "map": "@dynmark"
-            }
-          }
-        ]
-      }
-    },
-    {
-      "rule": {
-        "family": "ip",
-        "table": "dynset",
-        "chain": "test_ping",
-        "handle": 0,
-        "comment": "delete should be instant but might fail under memory pressure",
-        "expr": [
-          {
-            "match": {
-              "op": "==",
-              "left": {
-                "payload": {
-                  "protocol": "ip",
-                  "field": "saddr"
-                }
-              },
-              "right": "@dynmark"
-            }
-          },
-          {
-            "counter": {
-              "packets": 0,
-              "bytes": 0
-            }
-          }
-        ]
-      }
-    },
-    {
-      "rule": {
-        "family": "ip",
-        "table": "dynset",
-        "chain": "input",
-        "handle": 0,
-        "comment": "also check timeout-gc",
-        "expr": [
-          {
-            "map": {
-              "op": "add",
-              "elem": {
-                "elem": {
-                  "val": "10.2.3.4",
-                  "timeout": 2
-                }
-              },
-              "data": 2,
-              "map": "@dynmark"
-            }
-          }
-        ]
-      }
-    },
-    {
-      "rule": {
-        "family": "ip",
-        "table": "dynset",
-        "chain": "input",
-        "handle": 0,
-        "expr": [
-          {
-            "match": {
-              "op": "==",
-              "left": {
-                "meta": {
-                  "key": "l4proto"
-                }
-              },
-              "right": 1
-            }
-          },
-          {
-            "match": {
-              "op": "==",
-              "left": {
-                "payload": {
-                  "protocol": "ip",
-                  "field": "daddr"
-                }
-              },
-              "right": "127.0.0.42"
-            }
-          },
-          {
-            "jump": {
-              "target": "test_ping"
-            }
-          }
-        ]
-      }
-    }
-  ]
-}
tests/shell/testcases/maps/dumps/typeof_maps_add_delete.nft deleted +0 -22
deleted file mode 100644
index 3f3ef17dd5493..0000000000000
@@ -1,22 +0,0 @@
-table ip dynset {
-	map dynmark {
-		typeof ip daddr : meta mark
-		size 64
-		counter
-		timeout 5m
-	}
-
-	chain test_ping {
-		ip saddr @dynmark counter packets 0 bytes 0 comment "should not increment"
-		ip saddr != @dynmark add @dynmark { ip saddr : 0x00000001 } counter packets 1 bytes 84
-		ip saddr @dynmark counter packets 1 bytes 84 comment "should increment"
-		ip saddr @dynmark delete @dynmark { ip saddr : 0x00000001 }
-		ip saddr @dynmark counter packets 0 bytes 0 comment "delete should be instant but might fail under memory pressure"
-	}
-
-	chain input {
-		type filter hook input priority filter; policy accept;
-		add @dynmark { 10.2.3.4 timeout 2s : 0x00000002 } comment "also check timeout-gc"
-		meta l4proto 1 ip daddr 127.0.0.42 jump test_ping
-	}
-}
tests/shell/testcases/maps/dumps/typeof_maps_add_delete.nodump new file +0 -0
new file mode 100644
index 0000000000000..e69de29bb2d1d
Signature · 1 line
2.54.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Phil Sutter

Testing on a (probably slow) aarch64 machine yielded dump failure since ruleset listing had '# count 1' appended to map size statement. The 3s delay supposedly wasn't long enough for the element to be reapped after disabling.

The test itself seems to perform all desired ruleset checks though, so just drop the stored dumps to avoid this problem.

Annoying, but spurious failures suck more:

author reviewer
#2 lore raw
Quoted 10 lines · Florian Westphal
Quoted 7 lines · Phil Sutter

Testing on a (probably slow) aarch64 machine yielded dump failure since ruleset listing had '# count 1' appended to map size statement. The 3s delay supposedly wasn't long enough for the element to be reapped after disabling.

The test itself seems to perform all desired ruleset checks though, so just drop the stored dumps to avoid this problem.

Annoying, but spurious failures suck more:

Well, there might be another way involving timeout and gc-interval tweaks, but AIUI the test didn't intend to check gc reliability or "performance". Moreover, delayed execution of gc due to high system load is expected, right?

Sadly, it's not the only test which becomes unstable with system load and delays. Looking at estimate_timeout in sets/0044interval_overlap_0, variance in system load may also reduce test stability. :(

Quoted 1 line

Thanks, Phil

author reviewer
#3 lore raw
In reply to Phil Sutter
Quoted 10 lines · Phil Sutter

Testing on a (probably slow) aarch64 machine yielded dump failure since ruleset listing had '# count 1' appended to map size statement. The 3s delay supposedly wasn't long enough for the element to be reapped after disabling.

The test itself seems to perform all desired ruleset checks though, so just drop the stored dumps to avoid this problem.

Fixes a8260c056a69a ("tests: add dynmap datapath add/delete test case")

Patch applied.