tests: monitor: Fix monitor JSON output for insert command
Phil Sutter
reviewerPATCH 1/4 tests: monitor: Fix monitor JSON output for insert command
Looks like commit ba786ac758fba ("tests: monitor: update insert and replace commands") missed to also fix expected JSON output.
--- tests/monitor/testcases/simple.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/monitor/testcases/simple.t +1 -1
@@ -15,7 +15,7 @@ J {"add": {"rule": {"family": "ip", "table": "t", "chain": "c", "handle": 0, "ex I insert rule ip t c counter accept O insert rule ip t c counter packets 0 bytes 0 accept -J {"add": {"rule": {"family": "ip", "table": "t", "chain": "c", "handle": 0, "expr": [{"counter": {"packets": 0, "bytes": 0}}, {"accept": null}]}}} +J {"insert": {"rule": {"family": "ip", "table": "t", "chain": "c", "handle": 0, "expr": [{"counter": {"packets": 0, "bytes": 0}}, {"accept": null}]}}} I replace rule ip t c handle 2 accept comment "foo bar" O delete rule ip t c handle 2
Signature · 1 line
2.41.0
Phil Sutter
reviewerPATCH 2/4 tests: monitor: Fix time format in ct timeout test
The old "plain" numbers are still accepted (and assumed to be in seconds), but output will use units which is unexpected due to 'O -'. Adjust input instead of adding this subtly different output line.
--- tests/monitor/testcases/object.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/monitor/testcases/object.t +1 -1
@@ -37,7 +37,7 @@ I delete ct helper ip t cth O - J {"delete": {"ct helper": {"family": "ip", "name": "cth", "table": "t", "handle": 0, "type": "sip", "protocol": "tcp", "l3proto": "ip"}}} -I add ct timeout ip t ctt { protocol udp; l3proto ip; policy = { unreplied : 15, replied : 12 }; } +I add ct timeout ip t ctt { protocol udp; l3proto ip; policy = { unreplied : 15s, replied : 12s }; } O - J {"add": {"ct timeout": {"family": "ip", "name": "ctt", "table": "t", "handle": 0, "protocol": "udp", "l3proto": "ip", "policy": {"unreplied": 15, "replied": 12}}}}
Signature · 1 line
2.41.0
Phil Sutter
reviewerPATCH 3/4 tests: monitor: Fix for wrong syntax in set-interval.t
In reply to Phil SutterExpected JSON output must be prefixed 'J'.
--- tests/monitor/testcases/set-interval.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/monitor/testcases/set-interval.t +1 -1
@@ -27,4 +27,4 @@ J {"add": {"rule": {"family": "ip", "table": "t", "chain": "c", "handle": 0, "ex # ... and anon concat range I add rule ip t c ether saddr . ip saddr { 08:00:27:40:f7:09 . 192.168.56.10-192.168.56.12 } O - -{"add": {"rule": {"family": "ip", "table": "t", "chain": "c", "handle": 0, "expr": [{"match": {"op": "==", "left": {"concat": [{"payload": {"protocol": "ether", "field": "saddr"}}, {"payload": {"protocol": "ip", "field": "saddr"}}]}, "right": {"set": [{"concat": ["08:00:27:40:f7:09", {"range": ["192.168.56.10", "192.168.56.12"]}]}]}}}]}}} +J {"add": {"rule": {"family": "ip", "table": "t", "chain": "c", "handle": 0, "expr": [{"match": {"op": "==", "left": {"concat": [{"payload": {"protocol": "ether", "field": "saddr"}}, {"payload": {"protocol": "ip", "field": "saddr"}}]}, "right": {"set": [{"concat": ["08:00:27:40:f7:09", {"range": ["192.168.56.10", "192.168.56.12"]}]}]}}}]}}}
Signature · 1 line
2.41.0
Phil Sutter
reviewerPATCH 4/4 tests: monitor: Fix for wrong ordering in expected JSON output
In reply to Phil SutterAdjust JSON for delete before add for replace after respective kernel fix, too.
--- tests/monitor/testcases/simple.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/monitor/testcases/simple.t +1 -1
@@ -20,8 +20,8 @@ J {"insert": {"rule": {"family": "ip", "table": "t", "chain": "c", "handle": 0, I replace rule ip t c handle 2 accept comment "foo bar" O delete rule ip t c handle 2 O add rule ip t c handle 5 accept comment "foo bar" -J {"add": {"rule": {"family": "ip", "table": "t", "chain": "c", "handle": 0, "comment": "foo bar", "expr": [{"accept": null}]}}} J {"delete": {"rule": {"family": "ip", "table": "t", "chain": "c", "handle": 0, "expr": [{"accept": null}]}}} +J {"add": {"rule": {"family": "ip", "table": "t", "chain": "c", "handle": 0, "comment": "foo bar", "expr": [{"accept": null}]}}} I add counter ip t cnt O add counter ip t cnt { packets 0 bytes 0 }
Signature · 1 line
2.41.0
Phil Sutter
reviewerQuoted 5 lines · Phil Sutter
Looks like commit
ba786ac758fba("tests: monitor: update insert and replace commands") missed to also fix expected JSON output.Fixes 48d20b8cf162e ("monitor: honor NLM_F_APPEND flag for rules")Signed-off-by Phil Sutter <[email protected]>
Series applied.