P-Peaceful opened a new pull request, #4091:
URL: https://github.com/apache/hertzbeat/pull/4091

   ## What's changed?
   
   <!-- Describe Your PR Here -->
   
   This PR fixes the e2e test failure caused by the `api-testing` reverse test 
behavior.
   
   ### Description
   
   `api-testing` automatically runs reverse tests after the main test cases.
   
   For requests with `Authorization` header, reverse test will:
   - keep the original header
   - replace it with a random value
   - remove the header
   
   In the removed `useRevokedTokenToCallApi` case:
   - both "invalid token" and "missing token" scenarios return `401`
   - response body is empty / non-structured
   - therefore body assertion is skipped
   
   As a result:
   - reverse test cannot distinguish between expected and abnormal cases
   - the case is considered unsuitable for reverse testing
   - the whole test execution is marked as failed
   
   Example logs:
   
   ``` log
   
   e2e-testing    | start to run: 'createLabel'
   e2e-testing    | start to send request to http://hertzbeat:1157/api/label 
with method POST
   e2e-testing    | request header map[Authorization:[*** 
Content-Type:[application/json]]
   e2e-testing    | test case "createLabel", status code: 200
   e2e-testing    | add content-length: 42
   e2e-testing    | start to run: 'createLabel'
   e2e-testing    | start to send request to http://hertzbeat:1157/api/label 
with method POST
   e2e-testing    | request header map[Content-Type:[application/json]]
   e2e-testing    | test case "createLabel", status code: 401
   e2e-testing    | skip to read the body due to it is not struct content: ""
   e2e-testing    | start to run: 'createLabel'
   e2e-testing    | start to send request to http://hertzbeat:1157/api/label 
with method POST
   e2e-testing    | request header map[Authorization:[sh7s2m] 
Content-Type:[application/json]]
   e2e-testing    | test case "createLabel", status code: 401
   e2e-testing    | skip to read the body due to it is not struct content: ""
   
   ```
   
   ### Changes
   
   - remove `useRevokedTokenToCallApi` case from `e2e/testsuite.yaml`
   - upgrade `ghcr.io/linuxsuren/api-testing` from `v0.0.17` to `v0.0.19`
     - newer version provides more detailed request logs for debugging
   
   These changes make the e2e workflow stable and compatible with the current 
`api-testing` behavior.
   
   ## Checklist
   
   - [x]  I have read the [Contributing 
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide)
   - [ ]  I have written the necessary doc or comment.
   - [ ]  I have added the necessary unit tests and all cases have passed.
   
   ## Add or update API
   
   - [ ] I have added the necessary [e2e 
tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have 
passed.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to