nic-6443 opened a new pull request, #14233:
URL: https://github.com/apache/apisix/pull/14233

   ### Description
   
   `t/plugin/http-logger.t` TEST 31 and `t/plugin/elasticsearch-logger2.t` TEST 
26 have failed on master since #14157 merged. Both came from #14192 and match 
`init plugin-level conf version: \d+, from {...}` followed by the encoded conf 
containing `"include_req_body_expr":[["http_x_debug","~=",null]]`. #14157 
deliberately stopped `plugin.conf_version()` from logging the encoded conf, so 
that regex can no longer match.
   
   This keeps #14157's behaviour and only changes the two assertions, to
   
   ```
   qr/init plugin-level conf version: \d+ while logging request, client: /
   ```
   
   What those checks were there for in #14192 is that the conf holding the JSON 
`null` actually reaches `conf_version()`'s encoding in the log phase. The 
version line is only logged inside the branch that encodes the conf, after the 
encoding succeeded, and in both blocks the route's logger conf is the only conf 
that goes through `conf_version()`, so the line by itself still proves that. 
The conf content is pinned by the setup blocks (TEST 30 and TEST 25), and the 
rest of each block stays as it was: the entry is logged or sent, and `failed to 
run log_by_lua` / `is not supported by JSON` must not appear.
   
   The regex now also requires the log context to follow the version directly, 
so it fails if the conf is ever appended to that line again, which is the check 
#14229 asks for.
   
   The elasticsearch-logger check keeps catching the bug #14192 fixed: before 
#14192 a conf whose version probe had succeeded had `conf._version` set to the 
Elasticsearch major version, so `conf_version()` returned early and never 
logged the line. With the logger code from before #14192, TEST 26 fails on the 
new assertion; with the `plugin.lua` from before #14157 (which still appended 
the conf), both blocks fail on it as well.
   
   #### Which issue(s) this PR fixes:
   
   Fixes #14229
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   


-- 
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]

Reply via email to