@@ -203,7 +203,88 @@ SUCCESS: block definition takes precedence
203203
204204
205205
206- === TEST 8 : Load and execute custom plugin via extra_lua_path
206+ === TEST 8 : extra_lua_path with trailing semicolon should not produce double semicolons
207+ Verify that paths already ending with semicolons are handled correctly (no ;; in path)
208+ -- - extra_lua_path: / trailing/ semicolon/?. lua;
209+ -- - config
210+ location / t {
211+ content_by_lua_block {
212+ local path = package. path
213+ local found = string. find(path, " /trailing/semicolon/?.lua" , 1 , true)
214+ -- Check there is no double semicolon right after the custom path
215+ local double_sc = string. find(path, " /trailing/semicolon/?.lua;;" , 1 , true)
216+
217+ if found and not double_sc then
218+ ngx. say (" SUCCESS: trailing semicolon handled correctly" )
219+ elseif double_sc then
220+ ngx. say (" FAIL: double semicolons detected in path" )
221+ else
222+ ngx. say (" FAIL: path not found" )
223+ end
224+ }
225+ }
226+ -- - request
227+ GET / t
228+ -- - response_body
229+ SUCCESS: trailing semicolon handled correctly
230+
231+
232+
233+ === TEST 9 : extra_lua_cpath with trailing semicolon should not produce double semicolons
234+ Verify that cpaths already ending with semicolons are handled correctly
235+ -- - extra_lua_cpath: / trailing/ semicolon/?. so ;
236+ -- - config
237+ location / t {
238+ content_by_lua_block {
239+ local cpath = package. cpath
240+ local found = string. find(cpath, " /trailing/semicolon/?.so" , 1 , true)
241+ local double_sc = string. find(cpath, " /trailing/semicolon/?.so;;" , 1 , true)
242+
243+ if found and not double_sc then
244+ ngx. say (" SUCCESS: trailing semicolon handled correctly" )
245+ elseif double_sc then
246+ ngx. say (" FAIL: double semicolons detected in cpath" )
247+ else
248+ ngx. say (" FAIL: cpath not found" )
249+ end
250+ }
251+ }
252+ -- - request
253+ GET / t
254+ -- - response_body
255+ SUCCESS: trailing semicolon handled correctly
256+
257+
258+
259+ === TEST 10 : extra_lua_path from yaml_config with trailing semicolon
260+ Verify that yaml_config paths with trailing semicolons are handled correctly
261+ -- - extra_yaml_config
262+ apisix:
263+ extra_lua_path: " /yaml/trailing/?.lua;"
264+ -- - config
265+ location / t {
266+ content_by_lua_block {
267+ local path = package. path
268+ local found = string. find(path, " /yaml/trailing/?.lua" , 1 , true)
269+ local double_sc = string. find(path, " /yaml/trailing/?.lua;;" , 1 , true)
270+
271+ if found and not double_sc then
272+ ngx. say (" SUCCESS: yaml trailing semicolon handled correctly" )
273+ elseif double_sc then
274+ ngx. say (" FAIL: double semicolons detected in path" )
275+ else
276+ ngx. say (" FAIL: path not found" )
277+ end
278+ }
279+ }
280+ -- - request
281+ GET / t
282+ -- - response_body
283+ SUCCESS: yaml trailing semicolon handled correctly
284+
285+
286+
287+ === TEST 11 : Load and execute custom plugin via extra_lua_path
207288Verify that a real custom plugin can be loaded and executed using extra_lua_path
208289-- - extra_lua_path: t/ plugin/ custom-plugins/?. lua
209290-- - extra_yaml_config
0 commit comments