This is an automated email from the ASF dual-hosted git repository.
bzp2010 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new cf8429249 feat: move tinyyaml to lyaml (#11312)
cf8429249 is described below
commit cf8429249e7e28fa1fcdcec5f4d4b7b8612f4ca3
Author: Zeping Bai <[email protected]>
AuthorDate: Mon Jun 3 23:13:00 2024 +0800
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 +++----
t/node/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 f94aed127..ddd0d41e1 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 88d0522a7..c01736d16 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 ce8c83216..218c8743b 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 d1cb53d22..588f02aca 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 953fb1f09..225f41dbb 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 0d903496f..15df4dbc4 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 b11ae3564..1298cc1dd 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 a55787f4b..963700017 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 a97cf307e..08d019353 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 e901b57c5..4fb356185 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 f10c3651a..e199e5882 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 e11461a81..34c6949b8 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 36ce69efe..2ee975d0d 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 39d3cd4d9..7f31fc859 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 5fa2bfd43..3300aae42 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 816c797fa..9ec58f50c 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 aa90151c1..e2242e9a8 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 5d9e06c86..a9058f55d 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 b4d31b9d6..bb5efcc52 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\nBQAwWDELMAkGA1UEBhMCY24xEjAQBgNVBAgMCUd1YW5nRG9uZzEPMA0GA1UEBwwG\nWmh1SGFpMRYwFAYDVQQDDA1jYS5hcGlzaXguZGV2MQwwCgYDVQQLDANvcHMwHhcN\nMjIxMjAxMTAxOTU3WhcNNDIwODE4MTAxOTU3WjBOMQswCQYDVQQGEwJjbjESMBAG\nA1UECAwJR3VhbmdEb25nMQ8wDQYDVQQHDAZaaHVIYWkxGjAYBgNVBAMMEWNsaWVu\ndC5hcGlzaXguZGV2MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzypq\nkrsJ8MaqpS0kr2SboE9aRKOJzd6mY3AZLq3tFpio5cK5o
[...]
+ client_cert: "-----BEGIN
CERTIFICATE-----\nMIIDUzCCAjugAwIBAgIURw+Rc5FSNUQWdJD+quORtr9KaE8wDQYJKoZIhvcNAQEN\nBQAwWDELMAkGA1UEBhMCY24xEjAQBgNVBAgMCUd1YW5nRG9uZzEPMA0GA1UEBwwG\nWmh1SGFpMRYwFAYDVQQDDA1jYS5hcGlzaXguZGV2MQwwCgYDVQQLDANvcHMwHhcN\nMjIxMjAxMTAxOTU3WhcNNDIwODE4MTAxOTU3WjBOMQswCQYDVQQGEwJjbjESMBAG\nA1UECAwJR3VhbmdEb25nMQ8wDQYDVQQHDAZaaHVIYWkxGjAYBgNVBAMMEWNsaWVu\ndC5hcGlzaXguZGV2MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzypq\nkrsJ8MaqpS0kr2SboE9aRKOJzd6mY3AZLq3tFpio5cK5o
[...]
client_key: "-----BEGIN RSA PRIVATE
KEY-----\nMIIEpAIBAAKCAQEAzypqkrsJ8MaqpS0kr2SboE9aRKOJzd6mY3AZLq3tFpio5cK5\noIHkQLfeaaLcd4ycFcZwFTpxc+Eth6I0X9on+j4tEibc5IpDnRSAQlzHZzlrOG6W\nxcOza4VmfcrKqj27oodroqXv05r/5yIoRrEN9ZXfA8n2OnjhkP+C3Q68L6dBtPpv\n+e6HaAuw8MvcsEo+MQwucTZyWqWT2UzKVzToW29dHRW+yZGuYNWRh15X09VSvx+E\n0s+uYKzN0Cyef2C6VtBJKmJ3NtypAiPqw7Ebfov2Ym/zzU9pyWPi3P1mYPMKQqUT\n/FpZSXm4iSy0a5qTYhkFrFdV1YuYYZL5YGl9aQIDAQABAoIBAD7tUG//lnZnsj/4\nJXONaORaFj5ROrOpFPuRemS+egzqFCuuaXpC2lV6RH
[...]
nodes:
"127.0.0.1:10053": 1
@@ -85,7 +85,7 @@ routes:
upstream:
scheme: grpcs
tls:
- client_cert: "-----BEGIN
CERTIFICATE-----\nMIIDUzCCAjugAwIBAgIURw+Rc5FSNUQWdJD+quORtr9KaE8wDQYJKoZIhvcNAQEN\nBQAwWDELMAkGA1UEBhMCY24xEjAQBgNVBAgMCUd1YW5nRG9uZzEPMA0GA1UEBwwG\nWmh1SGFpMRYwFAYDVQQDDA1jYS5hcGlzaXguZGV2MQwwCgYDVQQLDANvcHMwHhcN\nMjIxMjAxMTAxOTU3WhcNNDIwODE4MTAxOTU3WjBOMQswCQYDVQQGEwJjbjESMBAG\nA1UECAwJR3VhbmdEb25nMQ8wDQYDVQQHDAZaaHVIYWkxGjAYBgNVBAMMEWNsaWVu\ndC5hcGlzaXguZGV2MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzypq\nkrsJ8MaqpS0kr2SboE9aRKOJzd6mY3AZLq3tFpio5cK5o
[...]
+ client_cert: "-----BEGIN
CERTIFICATE-----\nMIIDUzCCAjugAwIBAgIURw+Rc5FSNUQWdJD+quORtr9KaE8wDQYJKoZIhvcNAQEN\nBQAwWDELMAkGA1UEBhMCY24xEjAQBgNVBAgMCUd1YW5nRG9uZzEPMA0GA1UEBwwG\nWmh1SGFpMRYwFAYDVQQDDA1jYS5hcGlzaXguZGV2MQwwCgYDVQQLDANvcHMwHhcN\nMjIxMjAxMTAxOTU3WhcNNDIwODE4MTAxOTU3WjBOMQswCQYDVQQGEwJjbjESMBAG\nA1UECAwJR3VhbmdEb25nMQ8wDQYDVQQHDAZaaHVIYWkxGjAYBgNVBAMMEWNsaWVu\ndC5hcGlzaXguZGV2MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzypq\nkrsJ8MaqpS0kr2SboE9aRKOJzd6mY3AZLq3tFpio5cK5o
[...]
client_key: "-----BEGIN RSA PRIVATE
KEY-----\nMIIEpAIBAAKCAQEAzypqkrsJ8MaqpS0kr2SboE9aRKOJzd6mY3AZLq3tFpio5cK5\noIHkQLfeaaLcd4ycFcZwFTpxc+Eth6I0X9on+j4tEibc5IpDnRSAQlzHZzlrOG6W\nxcOza4VmfcrKqj27oodroqXv05r/5yIoRrEN9ZXfA8n2OnjhkP+C3Q68L6dBtPpv\n+e6HaAuw8MvcsEo+MQwucTZyWqWT2UzKVzToW29dHRW+yZGuYNWRh15X09VSvx+E\n0s+uYKzN0Cyef2C6VtBJKmJ3NtypAiPqw7Ebfov2Ym/zzU9pyWPi3P1mYPMKQqUT\n/FpZSXm4iSy0a5qTYhkFrFdV1YuYYZL5YGl9aQIDAQABAoIBAD7tUG//lnZnsj/4\nJXONaORaFj5ROrOpFPuRemS+egzqFCuuaXpC2lV6RH
[...]
nodes:
"127.0.0.1:10053": 1
diff --git a/t/node/healthcheck2.t b/t/node/healthcheck2.t
index e52cf13a0..d63e80ebd 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 56a238fb2..efe209051 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 6cd36db19..174252fd7 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 7ad685ac8..cd970c667 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 9f0688ba5..11acc7f32 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 941e89a3c..62b240235 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 b064838cd..650c87d10 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 9c5e67a48..dd90aec7d 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 929ed1aac..b6a266c47 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 83a181d17..d21b0629e 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 76651dd74..636ad2853 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 6171d12f6..1398fe891 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 89190448e..758f2aae9 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 f3aef6b5d..2d743fff0 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 2a6aa42f0..40936f7db 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 30172e2e3..3d0b8a80d 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: