222twotwotwo opened a new pull request, #947:
URL: https://github.com/apache/dubbo-go-pixiu/pull/947

   <!--  Thanks for sending a pull request! 
   -->
   
   **What this PR does**:
   
   This PR adds comprehensive layered unit and integration tests for the OPA 
policy management feature in the admin module, covering the full execution 
chain from configuration parsing to end-to-end HTTP request handling:
   
   
   1.  Adds 4 test files with 22 test functions + 16 sub-cases, all passing 
locally:
       - `admin/config/config_test.go`: Validates YAML deserialization of the 
`opa:` section, Go duration format parsing, graceful fallback when `opa:` 
section is missing, and error handling for invalid config paths
       - `admin/controller/opa/opa_test.go`: Verifies the 3-level parameter 
precedence chain (caller form value > Bootstrap config > default constant) and 
whitespace trimming behavior for `ServerURL` / `PolicyID` resolution
       - `admin/logic/opa_test.go`: Covers timeout fallback logic, URL 
construction rules, correctness of PUT/GET/DELETE HTTP requests, idempotent 404 
handling, and end-to-end validation that configured timeout correctly 
propagates to `context.WithTimeout`
       - `admin/initialize/router_opa_test.go`: Full-stack integration test 
running real Gin router + JWT authentication middleware + mocked OPA Server, 
validating route accessibility, JWT enforcement, parameter passthrough, 
full-chain timeout propagation, and policy read/write round-trip consistency
   
   2.  All tests run against real dependencies without excessive mocking:
       - Config tests write actual temporary YAML files
       - Integration tests do not bypass JWT middleware
       - Business logic tests use `httptest.NewServer` to simulate a real OPA 
server and catches regression in any layer of the execution path.
   
   **Which issue(s) this PR fixes**:
   <!--
   *Automatically closes linked issue when PR is merged.
   Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
   _If PR is about `failing-tests or flakes`, please post the related 
issues/tests in a comment and do not use `Fixes`_*
   -->
   Fixes #758 
   
   
   **Does this PR introduce a user-facing change?**:
   <!--
   If no, just write "NONE" in the release-note block below.
   If yes, a release note is required:
   Enter your extended release note in the block below. If the PR requires 
additional action from users switching to the new release, include the string 
"action required".
   -->
   ```release-note
   NONE
   ```


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