tests: shell: Fix for spurious fail in maps/typeof_maps_add_delete
Phil Sutter
reviewerPATCH 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.
--- .../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
@@ -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
@@ -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
Signature · 1 line
2.54.0
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:
Phil Sutter
reviewerQuoted 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
Acked-by Florian Westphal <[email protected]>
Thanks, Phil
Phil Sutter
reviewerQuoted 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")Signed-off-by Phil Sutter <[email protected]>
Patch applied.