Skip to content

Commit

Permalink
fix: check config.yaml plugins list is nil (apache#7926)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhendongcmss authored Sep 21, 2022
1 parent 41474f9 commit cd67060
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apisix/cli/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,22 @@ local config_schema = {
}
},
etcd = etcd_schema,
plugins = {
type = "array",
default = {},
minItems = 0,
items = {
type = "string"
}
},
stream_plugins = {
type = "array",
default = {},
minItems = 0,
items = {
type = "string"
}
},
wasm = {
type = "object",
properties = {
Expand Down
30 changes: 30 additions & 0 deletions t/config-center-yaml/plugin.t
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,33 @@ hello world
property "stream" validation failed: wrong type: expected boolean, got string
--- no_error_log
load(): plugins not changed
=== TEST 6: empty plugin list
--- apisix_yaml
plugins:
stream_plugins:
--- debug_config eval: $::debug_config
--- config
location /t {
content_by_lua_block {
ngx.sleep(0.3)
local http = require "resty.http"
local httpc = http.new()
local uri = "https://127.0.0.1:" .. ngx.var.server_port .. "/hello"
local res, err = httpc:request_uri(uri, {
method = "GET",
})
ngx.print(res.body)
}
}
--- request
GET /t
--- response_body
hello world
--- error_log
use config_center: yaml
--- grep_error_log_out
load(): new plugins: {}
load_stream(): new plugins: {}

0 comments on commit cd67060

Please sign in to comment.