hanzhe-one opened a new issue, #7968:
URL: https://github.com/apache/shenyu/issues/7968

   ### Behavior and reproduction
   
   `master` is red on the `shenyu-integrated-test-http` job: 
`CryptorResponsePluginTest.testWhenDoesntExistFiled` fails.
   
   Observed on the master push run for 
`679a9eb69cb5fc61f1ae242c8f5bdd4011ead8f7` ([job 
119079963808](https://github.com/apache/shenyu/actions/runs/39554456101/job/119079963808)):
   
   ```text
   [ERROR] 
org.apache.shenyu.integrated.test.http.combination.CryptorResponsePluginTest.testWhenDoesntExistFiled
  Time elapsed: 0.016 s  <<< FAILURE!
   java.lang.AssertionError:
   Expected: is "10001"
        but: was null
        at 
org.apache.shenyu.integrated.test.http.combination.CryptorResponsePluginTest.testWhenDoesntExistFiled(CryptorResponsePluginTest.java:129)
   ```
   
   The gateway response in the same run is the new configuration error:
   
   ```text
   postGateway(/http/test/payment) resp({"code":-116,"message":"Please check 
Cryptor response plugin's [fieldNames]"})
   ```
   
   ### Location and cause
   
   `11a39fda3` (#7903, "fix(cryptor): reject missing response fields") changed 
`CryptorResponsePlugin.fieldErrorParse` from returning the original body to 
throwing `ResponsiveException` with 
`ShenyuResultEnum.CRYPTOR_RESPONSE_ERROR_CONFIGURATION`:
   
   ```java
   protected String fieldErrorParse(final String originalBody, final 
ServerWebExchange exchange) {
       ShenyuResultEnum resultEnum = checkErrorEnum();
       throw new ResponsiveException(resultEnum.getCode(), resultEnum.getMsg() 
+ "[fieldNames]", exchange);
   }
   ```
   
   The integrated test still asserts the previous passthrough contract — that a 
missing field returns the original message — so it cannot pass against the new 
behavior:
   
   ```java
   @Test
   @DisplayName("return original message when request doesnt exist filed")
   public void testWhenDoesntExistFiled() throws Exception {
       initSelectorAndRules(PluginEnum.CRYPTOR_RESPONSE.getName(), "",
               SINGLETON_CONDITION_LIST, buildRuleLocalDataList("data", 
"decrypt", FIELD.getMapType()));
       UserDTO actualUser = HttpHelper.INSTANCE.postGateway(TEST_PATH, 
originalBody, UserDTO.class);
       assertThat(actualUser.getUserId(), is(originalBody.getUserId()));
       assertThat(actualUser.getUserName(), is(originalBody.getUserName()));
   }
   ```
   
   `#7903` validated only the cryptor module's unit tests and noted that 
end-to-end tests were not run, so the contract change reached `master` without 
the integrated test being updated.
   
   ### Expected behavior / suggested repair
   
   Update `testWhenDoesntExistFiled` to the behavior introduced by `#7903`: 
assert the `-116` configuration error (`CRYPTOR_RESPONSE_ERROR_CONFIGURATION`, 
message `Please check Cryptor response plugin's [fieldNames]`) instead of the 
original body, and rename the test so it no longer describes passthrough.
   
   If the passthrough contract is instead considered still required for this 
route, then `#7903` needs to be narrowed or reverted — but the test and the 
plugin must agree either way.
   
   `build (shenyu-integrated-test-http)` is required for the PR merge, so this 
failure currently blocks every open PR until it is fixed.
   
   Related: #6476 (the issue #7903 fixed).
   


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