Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: optional port for nod schema #10477

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apisix/schema_def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ local nodes_schema = {
type = "object",
}
},
required = {"host", "port", "weight"},
required = {"host", "weight"},
},
}
}
Expand Down
41 changes: 41 additions & 0 deletions t/admin/schema-validate.t
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,44 @@ location /t {
--- error_code: 400
--- response
{"error_msg":"allOf 1 failed: value should match only one schema, but matches none"}



=== TEST 13: Check node_schema optional port
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/routes',
ngx.HTTP_POST,
{
uri = "/hello",
upstream = {
type = "roundrobin",
nodes = {
{ host = "127.0.0.1:1980", weight = 1,}
}
},
methods = {"GET"},
}
)

if code >= 300 then
ngx.status = code
end
ngx.say(body)

}
}
--- request
GET /t
--- response_body
passed



=== TEST 14: Test route upstream
--- request
GET /hello
--- response_body
hello world
Loading