mikyll opened a new issue, #12344:
URL: https://github.com/apache/apisix/issues/12344

   ### Current Behavior
   
   In file 
[`t/APISIX.pm`](https://github.com/apache/apisix/blob/cba5ba93d49886972228c0db44fb49746d4ec156/t/APISIX.pm#L100),
 the content of variable `$user_yaml_config` is read from file 
`conf/config.yaml`, but immediately overridden with custom content:
   
   ```perl
   my $user_yaml_config = read_file("conf/config.yaml");
   ...
   $user_yaml_config = <<_EOC_;
   apisix:
     node_listen: 1984
     proxy_mode: http&stream
     stream_proxy:
       tcp:
         - 9100
     enable_resolv_search_opt: false
   _EOC_
   ```
   
   This makes the instruction `my $user_yaml_config = 
read_file("conf/config.yaml");` useless and it's impossible to load a custom 
configuration for APISIX tests.
   
   ### Expected Behavior
   
   I would expect to be able to load a **custom user configuration**, for 
APISIX tests, so that I can write custom unit tests for my custom plugins, and 
verify them with `nginx-test` framework.
   
   ### Error Logs
   
   -
   
   ### Steps to Reproduce
   
   Documentation references:
   
   - [APISIX Docs | Building APISIX - Running 
Tests](https://apisix.apache.org/docs/apisix/building-apisix/#running-tests)
   - [APISIX Docs | Introducing APISIX's testing 
framework](https://apisix.apache.org/docs/apisix/internal/testing-framework/)
   - [APISIX Blog | Getting Started with APISIX Test 
Cases](https://apisix.apache.org/blog/2022/06/27/getting-start-with-apisix-test-cases/)
   
   There's not much to reproduce: the APISIX.pm module simply overrides the 
configuration variable.
   
   I tested this on Docker (installing APISIX + test-nginx framework, following 
the links I provided).
   
   I was able to load a custom user configuration simply changing the operator 
from assign `=` to append `.=`:
   
   ```perl
   $user_yaml_config .= <<_EOC_;
   apisix:
     node_listen: 1984
     proxy_mode: http&stream
     stream_proxy:
       tcp:
         - 9100
     enable_resolv_search_opt: false
   _EOC_
   ```
   
   ### Environment
   
   - APISIX version (run `apisix version`): any, but I used 3.12.0 for tests
   - Operating system (run `uname -a`): -
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): -
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`): -
   - APISIX Dashboard version, if relevant: -
   - Plugin runner version, for issues related to plugin runners: -
   - LuaRocks version, for installation issues (run `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-unsubscr...@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to