Skip to content

bug: in APISIX.pm $user_yaml_config is read from file but the content is overridden #12344

Open
@mikyll

Description

@mikyll

Current Behavior

In file t/APISIX.pm, the content of variable $user_yaml_config is read from file conf/config.yaml, but immediately overridden with custom content:

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:

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 .=:

$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): -

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcheckingcheck first if this issue occurred

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions