grapestore opened a new pull request, #12759:
URL: https://github.com/apache/apisix/pull/12759

   ### Description
   
   This PR adds support for setting custom Lua paths (`extra_lua_path` and 
`extra_lua_cpath`) in test files, aligning the test framework behavior with 
APISIX runtime configuration.
   
   Previously, while APISIX runtime supported `apisix.extra_lua_path` in 
`config.yaml` to load custom plugins from specified directories, the test 
framework (`t/APISIX.pm`) did not respect this configuration. This made it 
impossible to write tests for custom plugins located in custom directories.
   
   This PR implements two complementary methods for setting custom Lua paths in 
tests:
   
   **Method 1: Block definitions (preferred)**
   --- extra_lua_path: /custom/path/?.lua
   --- extra_lua_cpath: /custom/path/?.so**Method 2: Automatic parsing from 
extra_yaml_config**
   --- extra_yaml_config
   apisix:
     extra_lua_path: "/custom/path/?.lua"
     extra_lua_cpath: "/custom/path/?.so"The implementation:
   - Prepends custom paths to `lua_package_path` and `lua_package_cpath` 
(matching runtime behavior)
   - Block definitions take precedence when both methods are used
   - Enables testing custom plugins without modifying core APISIX paths
   
   #### Which issue(s) this PR fixes:
   
   Fixes #12389
   
   ### 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
   - [x] 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)
   
   **Test Coverage:**
   Added comprehensive test suite in `t/admin/extra-lua-path.t` covering:
   - Path addition via block definitions
   - YAML configuration parsing
   - Simultaneous lua_path and lua_cpath configuration
   - Correct path prepending behavior
   - Precedence rules between configuration methods
   
   **Backward Compatibility:**
   This change is fully backward compatible. It only adds new optional block 
definitions (`extra_lua_path`, `extra_lua_cpath`) and parsing logic for 
existing `extra_yaml_config`. All existing tests continue to work without 
modification.


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