You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "ro4i7 (via GitHub)" <gi...@apache.org> on 2023/03/12 14:23:35 UTC

[GitHub] [apisix] ro4i7 commented on issue #7990: Merge `extra_init_by_lua_start ` and `extra_init_by_lua ` directive in test cases

ro4i7 commented on issue #7990:
URL: https://github.com/apache/apisix/issues/7990#issuecomment-1465212940

   Hello @spacewander 
   
   if this issue is still open, please assign it to me, 
   
   The `extra_init_by_lua_start` and `extra_init_by_lua` directives are currently used separately in the test cases, here is an implementation to merge them into a single directive:
   
   ```
   -- Before
   ngx.config.debug = true
   
   -- extra_init_by_lua_start
   local mock_service = require("spec.plugins.proxy-cache.mock_service")
   mock_service:start()
   
   -- extra_init_by_lua
   local cjson = require("cjson")
   cjson.encode_empty_table_as_object(false)
   
   -- After
   ngx.config.debug = true
   
   -- extra_init_by_lua
   local mock_service = require("spec.plugins.proxy-cache.mock_service")
   mock_service:start()
   
   local cjson = require("cjson")
   cjson.encode_empty_table_as_object(false)
   
   ```
   This implementation moves the code from `extra_init_by_lua_start` to `extra_init_by_lua`, so that both directives are used together in a single block. This should have the same effect as before, but with a cleaner and more concise code.


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