brbzull0 commented on PR #13626:
URL: https://github.com/apache/trafficserver/pull/13626#issuecomment-5774635853
Rebased onto master and force-pushed, so here is what changed and why.
**The rebase.** #13609 merged and shared its first three commits with this
branch. A squash has no link to its originals, so git replayed already-landed
code and reported conflicts in `YAMLCodec.h`, `yaml_codecs.h`, `YamlCfg.h`,
`CtrlPrinters.cc` and `jsonrpc-architecture.en.rst`. Rebasing with those three
commits dropped removes all of them. Two commits remain, plus one new one.
**The test helper is gone.** The approved version added
`validate_json_data_matches`, which piped `traffic_ctl` into an inline `python
-c` comparison. `validate_json_contains`'s own docstring, in the same file,
argues against exactly that: the exit status of a shell pipeline is the
parser's, so a non-zero `traffic_ctl` exit never reaches the `ReturnCode`
check. The helper sat about forty lines above that text and did the thing it
warns about.
It was also redundant. All three handlers that write `result()["data"]` —
`HostDB.cc:198`, `Plugins.cc:118`, `Server.cc:204` — use `data` as the sole key
of the result node, so `validate_json_contains(result={'data': ...})` asserts
the same thing and additionally fails if a sibling of `data` ever appears. Both
call sites now use it.
Two smaller fixes in that commit: the separate
`validate_json_contains(jsonrpc='2.0')` assertion is dropped, since the
envelope version is already asserted byte-exactly in
`traffic_ctl_json_null.test.py` and the `result={'data': ...}` expectation
proves the envelope is emitted anyway; and the output test gains
`Test.SkipUnless(Condition.PluginExists(...))`, which every other
plugin-loading autest has — without it a missing `.so` reaches `Fatal()` in
`Plugin.cc:222` instead of skipping.
`traffic_ctl_json_null.test.py` is touched for the same reason: it carried
`Once plugin list honours -f json, add: ...`, which this PR discharges,
alongside a claim that `validate_json_contains` cannot reach
`result.data.plugins`, which the spelling above disproves.
**One new commit.** `traffic_ctl: render JSON field mismatches key-sorted`
changes `_check_json_fields`'s failure output. This PR is the first caller to
pass a nested expectation, and a nested mismatch rendered as a single `repr()`
pair on one line — actual in emission order, expected in source order — meant
comparing two ~220-character inline dicts to find the differing key. Both sides
are now serialized the same way, key-sorted, one per line. It is a separate
commit because it touches shared code this PR only uses rather than introduces;
drop it if you would rather it went separately.
**Unchanged:** all three C++ files are byte-identical to the approved
revision. Only the autests moved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]