许亚东
unread,May 7, 2025, 6:01:31 AMMay 7Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
"Dear experts, I'm using Busted to test my OpenResty Lua project, which uses MySQL via openresty/lua-resty-mysql. Here is my code structure:
Test target: res.lua
Test case: test_res.lua
NGINX mock: mock_ngx.lua
When executing busted test/utils/test_res.lua, it fails with the error:
utils.res mysql init
/usr/local/openresty/lualib/resty/core/base.lua:80: loop or previous error loading module 'socket'
I suspect this is due to an incomplete mock of ngx.socket, but I don't know how to fix it.
Questions:
1. Can Busted be used for testing OpenResty + Lua projects, or is there a better approach?
2. Does anyone have a complete ngx mock example that I can use? Thank you very much!"