From cf8429249e7e28fa1fcdcec5f4d4b7b8612f4ca3 Mon Sep 17 00:00:00 2001 From: Zeping Bai Date: Mon, 3 Jun 2024 23:13:00 +0800 Subject: [PATCH] feat: move tinyyaml to lyaml (#11312) --- apisix-master-0.rockspec | 1 - apisix/cli/file.lua | 19 ++----- apisix/core/config_yaml.lua | 4 +- apisix/debug.lua | 4 +- conf/config-default.yaml | 4 +- docs/en/latest/plugins/body-transformer.md | 4 +- t/cli/test_admin.sh | 3 +- t/cli/test_main.sh | 8 +-- t/cli/test_prometheus_run_in_privileged.sh | 18 +++--- t/config-center-yaml/consumer.t | 19 ++----- t/config-center-yaml/plugin-configs.t | 8 +-- t/config-center-yaml/plugin-metadata.t | 2 +- t/config-center-yaml/plugin.t | 29 ++++++---- t/core/config_etcd.t | 8 +-- t/core/etcd-mtls.t | 2 + t/kubernetes/discovery/kubernetes2.t | 36 ++++++------ t/kubernetes/discovery/kubernetes3.t | 8 +-- t/kubernetes/discovery/stream/kubernetes.t | 4 +- t/node/grpc-proxy-mtls.t | 4 +- t/node/healthcheck2.t | 6 +- t/node/https-proxy.t | 6 +- t/node/least_conn.t | 17 ++---- t/node/priority-balancer/health-checker.t | 8 +-- t/node/priority-balancer/sanity.t | 24 +++----- t/node/upstream-discovery.t | 6 +- t/node/upstream-domain-with-special-dns.t | 15 ++--- .../upstream-domain-with-special-ipv6-dns.t | 3 +- t/plugin/body-transformer.t | 4 +- t/plugin/dubbo-proxy/route.t | 10 +--- t/plugin/log-rotate2.t | 7 +-- t/plugin/opentelemetry3.t | 5 +- t/plugin/prometheus4.t | 55 +++++++------------ t/plugin/zipkin3.t | 4 +- t/router/radixtree-host-uri2.t | 8 +-- t/stream-node/priority-balancer.t | 9 +-- 35 files changed, 157 insertions(+), 215 deletions(-) diff --git a/apisix-master-0.rockspec b/apisix-master-0.rockspec index f94aed12749e..ddd0d41e191f 100644 --- a/apisix-master-0.rockspec +++ b/apisix-master-0.rockspec @@ -51,7 +51,6 @@ dependencies = { "lua-protobuf = 0.5.0-1", "lua-resty-openidc = 1.7.6-3", "luafilesystem = 1.7.0-2", - "api7-lua-tinyyaml = 0.4.4", "nginx-lua-prometheus-api7 = 0.20240201-1", "jsonschema = 0.9.8", "lua-resty-ipmatcher = 0.6.1", diff --git a/apisix/cli/file.lua b/apisix/cli/file.lua index 88d0522a7e77..c01736d16180 100644 --- a/apisix/cli/file.lua +++ b/apisix/cli/file.lua @@ -15,7 +15,7 @@ -- limitations under the License. -- -local yaml = require("tinyyaml") +local yaml = require("lyaml") local profile = require("apisix.core.profile") local util = require("apisix.cli.util") local dkjson = require("dkjson") @@ -23,7 +23,6 @@ local dkjson = require("dkjson") local pairs = pairs local type = type local tonumber = tonumber -local getmetatable = getmetatable local getenv = os.getenv local str_gmatch = string.gmatch local str_find = string.find @@ -157,14 +156,6 @@ local function replace_by_reserved_env_vars(conf) end -local function tinyyaml_type(t) - local mt = getmetatable(t) - if mt then - return mt.__type - end -end - - local function path_is_multi_type(path, type_val) if str_sub(path, 1, 14) == "nginx_config->" and (type_val == "number" or type_val == "string") then @@ -188,7 +179,7 @@ local function merge_conf(base, new_tab, ppath) for key, val in pairs(new_tab) do if type(val) == "table" then - if tinyyaml_type(val) == "null" then + if val == yaml.null then base[key] = nil elseif tab_is_array(val) then @@ -243,7 +234,7 @@ function _M.read_yaml_conf(apisix_home) return nil, err end - local default_conf = yaml.parse(default_conf_yaml) + local default_conf = yaml.load(default_conf_yaml) if not default_conf then return nil, "invalid config-default.yaml file" end @@ -266,7 +257,7 @@ function _M.read_yaml_conf(apisix_home) end if not is_empty_file then - local user_conf = yaml.parse(user_conf_yaml) + local user_conf = yaml.load(user_conf_yaml) if not user_conf then return nil, "invalid config.yaml file" end @@ -306,7 +297,7 @@ function _M.read_yaml_conf(apisix_home) local apisix_conf_path = profile:yaml_path("apisix") local apisix_conf_yaml, _ = util.read_file(apisix_conf_path) if apisix_conf_yaml then - local apisix_conf = yaml.parse(apisix_conf_yaml) + local apisix_conf = yaml.load(apisix_conf_yaml) if apisix_conf then local ok, err = resolve_conf_var(apisix_conf) if not ok then diff --git a/apisix/core/config_yaml.lua b/apisix/core/config_yaml.lua index ce8c8321663a..218c8743bd7d 100644 --- a/apisix/core/config_yaml.lua +++ b/apisix/core/config_yaml.lua @@ -21,7 +21,7 @@ local config_local = require("apisix.core.config_local") local config_util = require("apisix.core.config_util") -local yaml = require("tinyyaml") +local yaml = require("lyaml") local log = require("apisix.core.log") local json = require("apisix.core.json") local new_tab = require("table.new") @@ -100,7 +100,7 @@ local function read_apisix_yaml(premature, pre_mtime) local yaml_config = f:read("*a") f:close() - local apisix_yaml_new = yaml.parse(yaml_config) + local apisix_yaml_new = yaml.load(yaml_config) if not apisix_yaml_new then log.error("failed to parse the content of file " .. apisix_yaml_path) return diff --git a/apisix/debug.lua b/apisix/debug.lua index d1cb53d229db..588f02aca438 100644 --- a/apisix/debug.lua +++ b/apisix/debug.lua @@ -15,7 +15,7 @@ -- limitations under the License. -- local require = require -local yaml = require("tinyyaml") +local yaml = require("lyaml") local log = require("apisix.core.log") local profile = require("apisix.core.profile") local lfs = require("lfs") @@ -130,7 +130,7 @@ local function read_debug_yaml() local yaml_config = f:read("*a") f:close() - local debug_yaml_new = yaml.parse(yaml_config) + local debug_yaml_new = yaml.load(yaml_config) if not debug_yaml_new then log.error("failed to parse the content of file " .. debug_yaml_path) return diff --git a/conf/config-default.yaml b/conf/config-default.yaml index 953fb1f098a3..225f41dbb116 100755 --- a/conf/config-default.yaml +++ b/conf/config-default.yaml @@ -53,7 +53,7 @@ apisix: memory_size: 50m # Size of the memory to store the cache index. disk_size: 1G # Size of the disk to store the cache data. disk_path: /tmp/disk_cache_one # Path to the cache file for disk cache. - cache_levels: 1:2 # Cache hierarchy levels of disk cache. + cache_levels: "1:2" # Cache hierarchy levels of disk cache. # - name: disk_cache_two # memory_size: 50m # disk_size: 1G @@ -73,7 +73,7 @@ apisix: ssl: radixtree_sni # radixtree_sni: match route by SNI # http is the default proxy mode. proxy_mode can be one of `http`, `stream`, or `http&stream` - proxy_mode: http + proxy_mode: "http" # stream_proxy: # TCP/UDP L4 proxy # tcp: # - addr: 9100 # Set the TCP proxy listening ports. diff --git a/docs/en/latest/plugins/body-transformer.md b/docs/en/latest/plugins/body-transformer.md index 0d903496f709..15df4dbc456d 100644 --- a/docs/en/latest/plugins/body-transformer.md +++ b/docs/en/latest/plugins/body-transformer.md @@ -118,8 +118,8 @@ For example, parse YAML to JSON yourself: ``` {% - local yaml = require("tinyyaml") - local body = yaml.parse(_body) + local yaml = require("lyaml") + local body = yaml.load(_body) %} {"foobar":"{{body.foobar.foo .. " " .. body.foobar.bar}}"} ``` diff --git a/t/cli/test_admin.sh b/t/cli/test_admin.sh index b11ae3564e79..1298cc1dd406 100755 --- a/t/cli/test_admin.sh +++ b/t/cli/test_admin.sh @@ -255,8 +255,7 @@ deployment: admin: allow_admin: ~ admin_key: - - - name: "admin" + - name: "admin" key: '' role: admin ' > conf/config.yaml diff --git a/t/cli/test_main.sh b/t/cli/test_main.sh index a55787f4be52..9637000176bb 100755 --- a/t/cli/test_main.sh +++ b/t/cli/test_main.sh @@ -664,8 +664,8 @@ echo "passed: disable ssl_session_tickets by default" # support 3rd-party plugin echo ' apisix: - extra_lua_path: "\$prefix/example/?.lua" - extra_lua_cpath: "\$prefix/example/?.lua" + extra_lua_path: "$prefix/example/?.lua" + extra_lua_cpath: "$prefix/example/?.lua" plugins: - 3rd-party stream_plugins: @@ -716,7 +716,7 @@ echo "passed: bad lua_module_hook should be rejected" echo ' apisix: proxy_mode: http&stream - extra_lua_path: "\$prefix/example/?.lua" + extra_lua_path: "$prefix/example/?.lua" lua_module_hook: "my_hook" stream_proxy: tcp: @@ -838,7 +838,7 @@ apisix: disk_path: /tmp/disk_cache_one disk_size: 100m memory_size: 20m - cache_levels: 1:2 + cache_levels: "1:2" ' > conf/config.yaml make init diff --git a/t/cli/test_prometheus_run_in_privileged.sh b/t/cli/test_prometheus_run_in_privileged.sh index a97cf307e26c..08d0193531ca 100755 --- a/t/cli/test_prometheus_run_in_privileged.sh +++ b/t/cli/test_prometheus_run_in_privileged.sh @@ -29,7 +29,7 @@ rm logs/error.log || true echo ' apisix: - extra_lua_path: "\$prefix/t/lib/?.lua" + extra_lua_path: "$prefix/t/lib/?.lua" nginx_config: error_log_level: info ' > conf/config.yaml @@ -53,10 +53,10 @@ echo "prometheus run in privileged agent successfully when only http is enabled" sleep 0.5 rm logs/error.log || true -echo " +echo ' apisix: - proxy_mode: http&stream - extra_lua_path: "\$prefix/t/lib/?.lua" + proxy_mode: "http&stream" + extra_lua_path: "$prefix/t/lib/?.lua" enable_admin: true stream_proxy: tcp: @@ -65,7 +65,7 @@ stream_plugins: - prometheus nginx_config: error_log_level: info -" > conf/config.yaml +' > conf/config.yaml make run sleep 0.1 @@ -86,10 +86,10 @@ make stop sleep 0.5 rm logs/error.log || true -echo " +echo ' apisix: - proxy_mode: http&stream - extra_lua_path: "\$prefix/t/lib/?.lua" + proxy_mode: "http&stream" + extra_lua_path: "$prefix/t/lib/?.lua" enable_admin: false stream_proxy: tcp: @@ -98,7 +98,7 @@ stream_plugins: - prometheus nginx_config: error_log_level: info -" > conf/config.yaml +' > conf/config.yaml make run sleep 0.1 diff --git a/t/config-center-yaml/consumer.t b/t/config-center-yaml/consumer.t index e901b57c5f9c..4fb356185933 100644 --- a/t/config-center-yaml/consumer.t +++ b/t/config-center-yaml/consumer.t @@ -34,19 +34,6 @@ deployment: _EOC_ $block->set_value("yaml_config", $yaml_config); - - my $routes = <<_EOC_; -routes: - - - uri: /hello - upstream: - nodes: - "127.0.0.1:1980": 1 - type: roundrobin -#END -_EOC_ - - $block->set_value("apisix_yaml", $block->apisix_yaml . $routes); }); run_tests(); @@ -57,6 +44,12 @@ __DATA__ --- apisix_yaml consumers: - username: jwt-auth +routes: + - uri: /hello + upstream: + nodes: + "127.0.0.1:1980": 1 + type: roundrobin #END --- request GET /hello diff --git a/t/config-center-yaml/plugin-configs.t b/t/config-center-yaml/plugin-configs.t index f10c3651ad45..e199e58825e3 100644 --- a/t/config-center-yaml/plugin-configs.t +++ b/t/config-center-yaml/plugin-configs.t @@ -58,7 +58,7 @@ routes: plugin_config_id: 1 upstream: nodes: - "127.0.0.1:1980":1 + "127.0.0.1:1980": 1 type: roundrobin #END --- response_body @@ -74,7 +74,7 @@ routes: plugin_config_id: 1 upstream: nodes: - "127.0.0.1:1980":1 + "127.0.0.1:1980": 1 type: roundrobin #END --- error_code: 503 @@ -105,7 +105,7 @@ routes: body: "world\n" upstream: nodes: - "127.0.0.1:1980":1 + "127.0.0.1:1980": 1 type: roundrobin #END --- request @@ -135,7 +135,7 @@ routes: plugin_config_id: 1 upstream: nodes: - "127.0.0.1:1980":1 + "127.0.0.1:1980": 1 type: roundrobin #END --- error_code: 503 diff --git a/t/config-center-yaml/plugin-metadata.t b/t/config-center-yaml/plugin-metadata.t index e11461a81cc3..34c6949b881a 100644 --- a/t/config-center-yaml/plugin-metadata.t +++ b/t/config-center-yaml/plugin-metadata.t @@ -58,7 +58,7 @@ routes: plugin_metadata: - id: http-logger log_format: - host: "$host", + host: "$host" remote_addr: "$remote_addr" #END --- request diff --git a/t/config-center-yaml/plugin.t b/t/config-center-yaml/plugin.t index 36ce69efe393..2ee975d0d990 100644 --- a/t/config-center-yaml/plugin.t +++ b/t/config-center-yaml/plugin.t @@ -36,18 +36,19 @@ _EOC_ $block->set_value("yaml_config", $yaml_config); - my $routes = <<_EOC_; + if (!$block->apisix_yaml) { + my $routes = <<_EOC_; routes: - - - uri: /hello + - uri: /hello upstream: - nodes: - "127.0.0.1:1980": 1 - type: roundrobin + nodes: + "127.0.0.1:1980": 1 + type: roundrobin #END _EOC_ - $block->set_value("apisix_yaml", $block->apisix_yaml . $routes); + $block->set_value("apisix_yaml", $block->extra_apisix_yaml . $routes); + } }); our $debug_config = t::APISIX::read_file("conf/debug.yaml"); @@ -55,10 +56,13 @@ $debug_config =~ s/basic:\n enable: false/basic:\n enable: true/; run_tests(); +## TODO: extra_apisix_yaml is specific to this document and is not standard behavior for +## the APISIX testing framework, so it should be standardized or replaced later. + __DATA__ === TEST 1: sanity ---- apisix_yaml +--- extra_apisix_yaml plugins: - name: ip-restriction - name: jwt-auth @@ -111,7 +115,7 @@ plugins: - jwt-auth stream_plugins: - mqtt-proxy ---- apisix_yaml +--- extra_apisix_yaml plugins: - name: ip-restriction - name: jwt-auth @@ -144,7 +148,7 @@ qr/(loaded plugin and sort by priority: (3000 name: ip-restriction|2510 name: jw === TEST 3: disable plugin and its router ---- apisix_yaml +--- extra_apisix_yaml plugins: - name: jwt-auth --- request @@ -162,6 +166,7 @@ routes: plugins: - name: public-api - name: prometheus +#END --- request GET /apisix/prometheus/metrics @@ -181,7 +186,7 @@ plugins: - jwt-auth stream_plugins: - mqtt-proxy ---- apisix_yaml +--- extra_apisix_yaml plugins: - name: xxx stream: ip-restriction @@ -197,7 +202,7 @@ load(): plugins not changed === TEST 6: empty plugin list ---- apisix_yaml +--- extra_apisix_yaml plugins: stream_plugins: --- debug_config eval: $::debug_config diff --git a/t/core/config_etcd.t b/t/core/config_etcd.t index 39d3cd4d9bbe..7f31fc8592be 100644 --- a/t/core/config_etcd.t +++ b/t/core/config_etcd.t @@ -36,7 +36,7 @@ deployment: etcd: prefix: "/apisix" host: - - "http://127.0.0.1:7777" -- wrong etcd port + - "http://127.0.0.1:7777" # wrong etcd port timeout: 1 --- config location /t { @@ -208,10 +208,10 @@ deployment: config_provider: etcd etcd: host: - - "http://127.0.0.1:1980" -- fake server port + - "http://127.0.0.1:1980" # fake server port timeout: 1 - user: root # root username for etcd - password: 5tHkHhYkjr6cQY # root password for etcd + user: root # root username for etcd + password: 5tHkHhYkjr6cQY # root password for etcd --- extra_init_by_lua local health_check = require("resty.etcd.health_check") health_check.get_target_status = function() diff --git a/t/core/etcd-mtls.t b/t/core/etcd-mtls.t index 5fa2bfd432c2..3300aae42639 100644 --- a/t/core/etcd-mtls.t +++ b/t/core/etcd-mtls.t @@ -159,6 +159,8 @@ deployment: cert: t/certs/mtls_client.crt key: t/certs/mtls_client.key verify: false + admin: + admin_key_required: false --- config location /t { content_by_lua_block { diff --git a/t/kubernetes/discovery/kubernetes2.t b/t/kubernetes/discovery/kubernetes2.t index 816c797face5..9ec58f50c3ad 100644 --- a/t/kubernetes/discovery/kubernetes2.t +++ b/t/kubernetes/discovery/kubernetes2.t @@ -36,8 +36,8 @@ discovery: token_file: "/tmp/var/run/secrets/kubernetes.io/serviceaccount/token" - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token_file: "/tmp/var/run/secrets/kubernetes.io/serviceaccount/token" @@ -366,8 +366,8 @@ discovery: token: ${KUBERNETES_CLIENT_TOKEN} - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token: ${KUBERNETES_CLIENT_TOKEN} @@ -405,8 +405,8 @@ discovery: equal: ns-a - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token: ${KUBERNETES_CLIENT_TOKEN} @@ -443,8 +443,8 @@ discovery: not_equal: ns-a - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token: ${KUBERNETES_CLIENT_TOKEN} @@ -481,8 +481,8 @@ discovery: match: [ns-a,ns-b] - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token: ${KUBERNETES_CLIENT_TOKEN} @@ -519,8 +519,8 @@ discovery: match: ["ns-[ab]"] - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token: ${KUBERNETES_CLIENT_TOKEN} @@ -557,8 +557,8 @@ discovery: not_match: ["ns-a"] - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token: ${KUBERNETES_CLIENT_TOKEN} @@ -595,8 +595,8 @@ discovery: not_match: ["ns-[ab]"] - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token: ${KUBERNETES_CLIENT_TOKEN} @@ -633,8 +633,8 @@ discovery: first=1,second - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token: ${KUBERNETES_CLIENT_TOKEN} diff --git a/t/kubernetes/discovery/kubernetes3.t b/t/kubernetes/discovery/kubernetes3.t index aa90151c1ce6..e2242e9a8c13 100644 --- a/t/kubernetes/discovery/kubernetes3.t +++ b/t/kubernetes/discovery/kubernetes3.t @@ -37,8 +37,8 @@ discovery: watch_endpoint_slices: true - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token_file: "/tmp/var/run/secrets/kubernetes.io/serviceaccount/token" @@ -401,8 +401,8 @@ discovery: watch_endpoint_slices: true - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token: ${KUBERNETES_CLIENT_TOKEN} diff --git a/t/kubernetes/discovery/stream/kubernetes.t b/t/kubernetes/discovery/stream/kubernetes.t index 5d9e06c86291..a9058f55dfe1 100644 --- a/t/kubernetes/discovery/stream/kubernetes.t +++ b/t/kubernetes/discovery/stream/kubernetes.t @@ -36,8 +36,8 @@ discovery: token_file: "/tmp/var/run/secrets/kubernetes.io/serviceaccount/token" - id: second service: - schema: "http", - host: "127.0.0.1", + schema: "http" + host: "127.0.0.1" port: "6445" client: token_file: "/tmp/var/run/secrets/kubernetes.io/serviceaccount/token" diff --git a/t/node/grpc-proxy-mtls.t b/t/node/grpc-proxy-mtls.t index b4d31b9d6698..bb5efcc5222d 100644 --- a/t/node/grpc-proxy-mtls.t +++ b/t/node/grpc-proxy-mtls.t @@ -56,7 +56,7 @@ routes: upstream: scheme: grpcs tls: - client_cert: "-----BEGIN CERTIFICATE-----\nMIIDUzCCAjugAwIBAgIURw+Rc5FSNUQWdJD+quORtr9KaE8wDQYJKoZIhvcNAQEN\n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aB3YBZ7h5pZkCgYEA1ejo\nKrR1hN2FMhp4pj0nZ5+Ry2lyIVbN4kIcoteaPhyQ0AQ0zNoi27EBRnleRwVDYECi\nXAFrgJU+laKsg1iPjvinHibrB9G2p1uv3BEh6lPl9wPFlENTOjPkqjR6eVVZGP8e\nVzxYxIo2x/QLDUeOpxySdG4pdhEHGfvmdGmr2FECgYBeknedzhCR4HnjcTSdmlTA\nwI+p9gt6XYG0ZIewCymSl89UR9RBUeh++HQdgw0z8r+CYYjfH3SiLUdU5R2kIZeW\nzXiAS55OO8Z7cnWFSI17sRz+RcbLAr3l4IAGoi9MO0awGftcGSc/QiFwM1s3bSSz\nPAzYbjHUpKot5Gae0PCeKQKBgQCHfkfRBQ2LY2WDHxFc+0+Ca6jF17zbMUioEIhi\n/X5N6XowyPlI6MM7tRrBsQ7unX7X8Rjmfl/ByschsTDk4avNO+NfTfeBtGymBYWX\nN6Lr8sivdkwoZZzKOSSWSzdos48ELlThnO/9Ti706Lg3aSQK5iY+aakJiC+fXdfT\n1TtsgQKBgQDRYvtK/Cpaq0W6wO3I4R75lHGa7zjEr4HA0Kk/FlwS0YveuTh5xqBj\nwQz2YyuQQfJfJs7kbWOITBT3vuBJ8F+pktL2Xq5p7/ooIXOGS8Ib4/JAS1C/wb+t\nuJHGva12bZ4uizxdL2Q0/n9ziYTiMc/MMh/56o4Je8RMdOMT5lTsRQ==\n-----END RSA PRIVATE KEY-----\n" nodes: "127.0.0.1:10053": 1 diff --git a/t/node/healthcheck2.t b/t/node/healthcheck2.t index e52cf13a052f..d63e80ebde4b 100644 --- a/t/node/healthcheck2.t +++ b/t/node/healthcheck2.t @@ -91,8 +91,7 @@ services: interval: 1 http_failures: 2 routes: - - - service_id: 1 + - service_id: 1 uri: /server_port #END --- config @@ -166,8 +165,7 @@ services: interval: 1 http_failures: 2 routes: - - - service_id: 1 + - service_id: 1 uri: /server_port upstream: type: roundrobin diff --git a/t/node/https-proxy.t b/t/node/https-proxy.t index 56a238fb2988..efe209051570 100644 --- a/t/node/https-proxy.t +++ b/t/node/https-proxy.t @@ -122,8 +122,8 @@ routes: nodes: "127.0.0.1:1983": 1 type: roundrobin - pass_host: "rewrite", - upstream_host: "www.test.com", + pass_host: "rewrite" + upstream_host: "www.test.com" #END --- request GET /uri @@ -149,7 +149,7 @@ routes: nodes: "localhost:1983": 1 type: roundrobin - pass_host: "node", + pass_host: "node" #END --- request GET /uri diff --git a/t/node/least_conn.t b/t/node/least_conn.t index 6cd36db1927d..174252fd713d 100644 --- a/t/node/least_conn.t +++ b/t/node/least_conn.t @@ -40,10 +40,9 @@ _EOC_ my $route = <<_EOC_; routes: - - - upstream_id: 1 + - upstream_id: 1 uris: - - /mysleep + - /mysleep #END _EOC_ @@ -61,8 +60,7 @@ __DATA__ === TEST 1: select highest weight --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: least_conn nodes: "127.0.0.1:1980": 2 @@ -77,8 +75,7 @@ proxy request to 127.0.0.1:1980 while connecting to upstream === TEST 2: select least conn --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: least_conn nodes: "127.0.0.1:1980": 3 @@ -121,8 +118,7 @@ proxy request to 127.0.0.1:1980 while connecting to upstream === TEST 3: retry --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: least_conn nodes: "127.0.0.1:1999": 2 @@ -140,8 +136,7 @@ proxy request to 127.0.0.1:1980 while connecting to upstream === TEST 4: retry all nodes, failed --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: least_conn nodes: "127.0.0.1:1999": 2 diff --git a/t/node/priority-balancer/health-checker.t b/t/node/priority-balancer/health-checker.t index 7ad685ac86bb..cd970c667d60 100644 --- a/t/node/priority-balancer/health-checker.t +++ b/t/node/priority-balancer/health-checker.t @@ -42,10 +42,9 @@ _EOC_ my $route = <<_EOC_; routes: - - - upstream_id: 1 + - upstream_id: 1 uris: - - /hello + - /hello #END _EOC_ @@ -64,8 +63,7 @@ __DATA__ === TEST 1: all are down detected by health checker --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: least_conn nodes: - host: 127.0.0.1 diff --git a/t/node/priority-balancer/sanity.t b/t/node/priority-balancer/sanity.t index 9f0688ba5e19..11acc7f32554 100644 --- a/t/node/priority-balancer/sanity.t +++ b/t/node/priority-balancer/sanity.t @@ -42,8 +42,7 @@ _EOC_ my $route = <<_EOC_; routes: - - - upstream_id: 1 + - upstream_id: 1 uris: - /hello - /mysleep @@ -65,8 +64,7 @@ __DATA__ === TEST 1: sanity --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: least_conn nodes: - host: 127.0.0.1 @@ -109,8 +107,7 @@ proxy request to 127.0.0.1:1980 === TEST 2: all failed --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: least_conn nodes: - host: 127.0.0.1 @@ -140,8 +137,7 @@ proxy request to 127.0.0.1:1979 === TEST 3: default priority is zero --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: least_conn nodes: - host: 127.0.0.1 @@ -171,8 +167,7 @@ proxy request to 127.0.0.1:1980 === TEST 4: least_conn --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: least_conn nodes: - host: 127.0.0.1 @@ -229,8 +224,7 @@ proxy request to 127.0.0.1:1980 while connecting to upstream === TEST 5: roundrobin --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: roundrobin nodes: - host: 127.0.0.1 @@ -265,8 +259,7 @@ proxy request to 127.0.0.4:1979 === TEST 6: ewma --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: ewma key: remote_addr nodes: @@ -297,8 +290,7 @@ proxy request to 127.0.0.3:1979 === TEST 7: chash --- apisix_yaml upstreams: - - - id: 1 + - id: 1 type: chash key: remote_addr nodes: diff --git a/t/node/upstream-discovery.t b/t/node/upstream-discovery.t index 941e89a3c069..62b240235b34 100644 --- a/t/node/upstream-discovery.t +++ b/t/node/upstream-discovery.t @@ -153,13 +153,11 @@ create_obj_fun(): upstream nodes: === TEST 3: create new server picker when nodes change, up_conf doesn't come from upstream --- apisix_yaml routes: - - - uris: + - uris: - /hello service_id: 1 services: - - - id: 1 + - id: 1 upstream: service_name: mock discovery_type: mock diff --git a/t/node/upstream-domain-with-special-dns.t b/t/node/upstream-domain-with-special-dns.t index b064838cde28..650c87d10f0b 100644 --- a/t/node/upstream-domain-with-special-dns.t +++ b/t/node/upstream-domain-with-special-dns.t @@ -58,8 +58,7 @@ __DATA__ --- listen_ipv6 --- apisix_yaml upstreams: - - - id: 1 + - id: 1 nodes: ipv6.test.local:1980: 1 type: roundrobin @@ -74,8 +73,7 @@ hello world --- log_level: debug --- apisix_yaml upstreams: - - - id: 1 + - id: 1 nodes: ttl.test.local:1980: 1 type: roundrobin @@ -117,8 +115,7 @@ deployment: config_provider: yaml --- apisix_yaml upstreams: - - - id: 1 + - id: 1 nodes: ttl.test.local:1980: 1 type: roundrobin @@ -152,8 +149,7 @@ connect to 127.0.0.1:1053 --- log_level: debug --- apisix_yaml upstreams: - - - id: 1 + - id: 1 nodes: ttl.1s.test.local:1980: 1 type: roundrobin @@ -200,8 +196,7 @@ deployment: config_provider: yaml --- apisix_yaml upstreams: - - - id: 1 + - id: 1 nodes: ttl.test.local:1980: 1 type: roundrobin diff --git a/t/node/upstream-domain-with-special-ipv6-dns.t b/t/node/upstream-domain-with-special-ipv6-dns.t index 9c5e67a48ed1..dd90aec7d0d1 100644 --- a/t/node/upstream-domain-with-special-ipv6-dns.t +++ b/t/node/upstream-domain-with-special-ipv6-dns.t @@ -58,8 +58,7 @@ __DATA__ --- listen_ipv6 --- apisix_yaml upstreams: - - - id: 1 + - id: 1 nodes: ipv6.test.local:1980: 1 type: roundrobin diff --git a/t/plugin/body-transformer.t b/t/plugin/body-transformer.t index 929ed1aac7c2..b6a266c47a82 100644 --- a/t/plugin/body-transformer.t +++ b/t/plugin/body-transformer.t @@ -473,8 +473,8 @@ qr/attempt to call global 'name' \(a string value\)/ local core = require("apisix.core") local req_template = [[ {% - local yaml = require("tinyyaml") - local body = yaml.parse(_body) + local yaml = require("lyaml") + local body = yaml.load(_body) %} {"foobar":"{{body.foobar.foo .. " " .. body.foobar.bar}}"} ]] diff --git a/t/plugin/dubbo-proxy/route.t b/t/plugin/dubbo-proxy/route.t index 83a181d17215..d21b0629e0d3 100644 --- a/t/plugin/dubbo-proxy/route.t +++ b/t/plugin/dubbo-proxy/route.t @@ -39,6 +39,7 @@ plugins: - dubbo-proxy - response-rewrite - proxy-rewrite + - key-auth _EOC_ $block->set_value("extra_yaml_config", $extra_yaml_config); @@ -161,9 +162,6 @@ dubbo success apisix: node_listen: 1984 enable_admin: true -plugins: - - key-auth - - dubbo-proxy --- config location /t { content_by_lua_block { @@ -228,9 +226,6 @@ passed apisix: node_listen: 1984 enable_admin: true -plugins: - - key-auth - - dubbo-proxy --- error_code: 401 @@ -240,9 +235,6 @@ plugins: apisix: node_listen: 1984 enable_admin: true -plugins: - - key-auth - - dubbo-proxy --- more_headers apikey: jack --- response_body diff --git a/t/plugin/log-rotate2.t b/t/plugin/log-rotate2.t index 76651dd7415f..636ad2853a06 100644 --- a/t/plugin/log-rotate2.t +++ b/t/plugin/log-rotate2.t @@ -25,7 +25,7 @@ no_root_location(); add_block_preprocessor(sub { my ($block) = @_; - if (! $block->extra_yaml_config) { + if (!defined $block->extra_yaml_config) { my $extra_yaml_config = <<_EOC_; plugins: - log-rotate @@ -136,10 +136,7 @@ passed === TEST 4: test rotate time align ---- yaml_config -apisix: - node_listen: 1984 - admin_key: ~ +--- extra_yaml_config plugins: - log-rotate plugin_attr: diff --git a/t/plugin/opentelemetry3.t b/t/plugin/opentelemetry3.t index 6171d12f6276..1398fe89186e 100644 --- a/t/plugin/opentelemetry3.t +++ b/t/plugin/opentelemetry3.t @@ -158,7 +158,10 @@ qr/request log: \{.*"opentelemetry_context_traceparent":"00-\w{32}-\w{16}-01".*\ === TEST 3: trigger opentelemetry with disable set variables ---- yaml_config +--- extra_yaml_config +plugins: + - http-logger + - opentelemetry plugin_attr: opentelemetry: set_ngx_var: false diff --git a/t/plugin/prometheus4.t b/t/plugin/prometheus4.t index 89190448e731..758f2aae984f 100644 --- a/t/plugin/prometheus4.t +++ b/t/plugin/prometheus4.t @@ -333,15 +333,7 @@ passed === TEST 11: remove prometheus -> reload -> send batch request -> add prometheus for next tests ---- config - location /t { - content_by_lua_block { - local http = require "resty.http" - local httpc = http.new() - - local t = require("lib.test_admin").test - ngx.sleep(0.1) - local data = [[ +--- yaml_config deployment: role: traditional role_traditional: @@ -351,36 +343,19 @@ deployment: apisix: node_listen: 1984 plugins: - - example-plugin + - example-plugin plugin_attr: - example-plugin: - val: 1 - ]] - require("lib.test_admin").set_config_yaml(data) + example-plugin: + val: 1 +--- config + location /t { + content_by_lua_block { + local t = require("lib.test_admin").test local code, _, org_body = t('/v1/plugins/reload', ngx.HTTP_PUT) - local code, body = t('/batch-process-metrics', - ngx.HTTP_GET - ) + local code, body = t('/batch-process-metrics', ngx.HTTP_GET) ngx.status = code ngx.say(body) - - local data = [[ -deployment: - role: traditional - role_traditional: - config_provider: etcd - admin: - admin_key: null -apisix: - node_listen: 1984 -plugins: - - prometheus -plugin_attr: - example-plugin: - val: 1 - ]] - require("lib.test_admin").set_config_yaml(data) } } --- request @@ -392,6 +367,18 @@ qr/404 Not Found/ === TEST 12: fetch prometheus metrics -> batch_process_entries metrics should not be present +--- yaml_config +deployment: + role: traditional + role_traditional: + config_provider: etcd + admin: + admin_key: null +apisix: + node_listen: 1984 +plugins: + - prometheus + - public-api --- request GET /apisix/prometheus/metrics --- error_code: 200 diff --git a/t/plugin/zipkin3.t b/t/plugin/zipkin3.t index f3aef6b5d8fe..2d743fff0db4 100644 --- a/t/plugin/zipkin3.t +++ b/t/plugin/zipkin3.t @@ -119,7 +119,9 @@ qr/ngx_var.zipkin_context_traceparent:00-\w{32}-\w{16}-01*/ === TEST 3: trigger zipkin with disable set variables ---- yaml_config +--- extra_yaml_config +plugins: + - zipkin plugin_attr: zipkin: set_ngx_var: false diff --git a/t/router/radixtree-host-uri2.t b/t/router/radixtree-host-uri2.t index 2a6aa42f0a9e..40936f7db9bc 100644 --- a/t/router/radixtree-host-uri2.t +++ b/t/router/radixtree-host-uri2.t @@ -80,7 +80,7 @@ use config_provider: yaml routes: - uri: /server_port - host: *.test.com + host: "*.test.com" upstream: nodes: "127.0.0.1:1981": 1 @@ -109,7 +109,7 @@ use config_provider: yaml routes: - uri: /* - host: *.test.com + host: "*.test.com" upstream: nodes: "127.0.0.1:1981": 1 @@ -138,7 +138,7 @@ use config_provider: yaml routes: - uri: /* - host: *.test.com + host: "*.test.com" filter_func: "function(vars) return vars.arg_name == 'json' end" upstream: nodes: @@ -168,7 +168,7 @@ use config_provider: yaml routes: - uri: /* - host: *.test.com + host: "*.test.com" filter_func: "function(vars) return vars.arg_name == 'json' end" upstream: nodes: diff --git a/t/stream-node/priority-balancer.t b/t/stream-node/priority-balancer.t index 30172e2e3c15..3d0b8a80d61c 100644 --- a/t/stream-node/priority-balancer.t +++ b/t/stream-node/priority-balancer.t @@ -54,8 +54,7 @@ __DATA__ === TEST 1: sanity --- apisix_yaml stream_routes: - - - id: 1 + - id: 1 upstream: type: least_conn nodes: @@ -100,8 +99,7 @@ proxy request to 127.0.0.1:1995 === TEST 2: default priority is 0 --- apisix_yaml stream_routes: - - - id: 1 + - id: 1 upstream: type: least_conn nodes: @@ -144,8 +142,7 @@ proxy request to 127.0.0.1:1995 === TEST 3: fix priority for nonarray nodes --- apisix_yaml stream_routes: - - - id: 1 + - id: 1 upstream: type: roundrobin nodes: