fix: support extra_lua_path in test framework#13476
Open
mikyll wants to merge 3 commits into
Open
Conversation
Co-authored-by: inkyu <87048860+grapestore@users.noreply.github.com>
Co-authored-by: inkyu <87048860+grapestore@users.noreply.github.com>
Co-authored-by: inkyu <87048860+grapestore@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was "forked" from #12759 due to inactivity 👀
Description
This PR adds support for setting custom Lua paths (
extra_lua_pathandextra_lua_cpath) in test files, aligning the test framework behavior with APISIX runtime configuration.What Problem Solves
Currently, you are not able to pass an extra Lua path to load custom plugins in APISIX testing framework. That makes it impossible to test custom plugins, without editing
APISIX.pmor via other workarounds.Suppose we have a CI/CD pipeline to release our APISIX instance:
Currently, the test framework overwrites the value of
extra_lua_pathof APISIX configuration. As a consequence, APISIX does never pick up the path of your custom plugins and cannot load them, making the tests fail.This change extends the test framework preprocessor in
t/APISIX.pmto extract and prepend custom Lua paths from block definitions or YAML configuration.Two methods:
Block definitions (preferred):
Automatic parsing from config.yaml:
Implementation
lua_package_pathandlua_package_cpath(matching runtime behavior)Example
File
t/plugin/my-custom-plugin.t:Which issue(s) this PR fixes:
Fixes #12389
Checklist
Test Coverage:
Added comprehensive test suite in
t/admin/extra-lua-path.tcovering: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 existingextra_yaml_config. All existing tests continue to work without modification.