You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/02/08 07:02:51 UTC

[GitHub] [apisix] leslie-tsang opened a new issue #6265: request help: the test case in `t/core/utils.t` need to be corrected

leslie-tsang opened a new issue #6265:
URL: https://github.com/apache/apisix/issues/6265


   ### Issue description
   
   The test case in [t/core/utils.t](https://github.com/apache/apisix/blob/ec0fc2ceaf04a20b0bd0ebdaad67296a1d3f621c/t/core/utils.t) currently has some code errors, such as
   
   https://github.com/apache/apisix/blob/ec0fc2ceaf04a20b0bd0ebdaad67296a1d3f621c/t/core/utils.t#L80-L89
   
   The variable `host` is a `nil` when the code is executed here (which may never happened)
   
   ## Solution
   Let's do it this way.
   ```patch
                local core = require("apisix.core")
                local resolvers = {"8.8.8.8"}
                core.utils.set_resolver(resolvers)
   -            local ip_info, err = core.utils.dns_parse("github.com")
   +            local domain = "github.com"
   +            local ip_info, err = core.utils.dns_parse(domain)
                if not ip_info then
   -                core.log.error("failed to parse domain: ", host, ", error: ",err)
   +                core.log.error("failed to parse domain: ", domain, ", error: ",err)
                end
                ngx.say(require("toolkit.json").encode(ip_info))
   ```
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):
   - OS (cmd: `uname -a`):
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   - etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `luarocks --version`):
   


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



[GitHub] [apisix] mangoGoForward commented on issue #6265: request help: the test case in `t/core/utils.t` need to be corrected

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on issue #6265:
URL: https://github.com/apache/apisix/issues/6265#issuecomment-1038576876


   I'd like to work on this issue.


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



[GitHub] [apisix] spacewander closed issue #6265: request help: the test case in `t/core/utils.t` need to be corrected

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #6265:
URL: https://github.com/apache/apisix/issues/6265


   


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



[GitHub] [apisix] spacewander closed issue #6265: request help: the test case in `t/core/utils.t` need to be corrected

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #6265:
URL: https://github.com/apache/apisix/issues/6265


   


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