You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "grapestore (via GitHub)" <gi...@apache.org> on 2025/11/19 02:20:20 UTC

[PR] fix: support extra_lua_path in test framework [apisix]

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

   ### 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
   - [ ] 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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: support extra_lua_path in test framework [apisix]

Posted by "grapestore (via GitHub)" <gi...@apache.org>.
grapestore closed pull request #12758: fix: support extra_lua_path in test framework
URL: https://github.com/apache/apisix/pull/12758


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org