-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix: optional port for nod schema #10477
Conversation
cheers |
@theweakgod Could you add a test case to cover this? |
Ok, can you tell me how to add a test case. Or some doc that tells me how to add it |
done! |
t/core/schema_def_optional_port.t
Outdated
local schema_def = require("apisix.schema_def") | ||
local core = require("apisix.core") | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant blank
t/core/schema_def_optional_port.t
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@theweakgod, the test case you added aren't up to the mark. Please demonstrate using domain name in the nodes without port is acceptable and accessing a route that uses such upstream does not fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you should prove that the route could work
t/core/schema_def_optional_port.t
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add a new test file, add it here: https://github.com/apache/apisix/blob/master/t/admin/schema-validate.t
@monkeyDluffy6017 @shreemaan-abhishek all done |
please make the ci pass |
ok,updated |
Is this error a problem with the test file? What do I need to do? |
@theweakgod It was a flaky test. I rerun the CI and it passed. |
Ok, I see. |
t/admin/schema-validate.t
Outdated
|
||
=== TEST 14: Test route upstream | ||
--- request | ||
GET /ip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Revolyssup Would you like to update these test cases? it is better not to use httpbin.org
, it is unstable, and we could check the response body like the other test cases, and no need to add X-API-KEY
in the request header and so on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
I remove some useless code.
t/admin/schema-validate.t
Outdated
upstream = { | ||
type = "roundrobin", | ||
nodes = { | ||
{ host = "nghttp2.org", weight = 1,} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use 127.0.0.1:1980
instead
t/admin/schema-validate.t
Outdated
local code, body = t('/apisix/admin/routes', | ||
ngx.HTTP_POST, | ||
{ | ||
uri = "/ip", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could search 127.0.0.1:1980
in the project, and find what uri is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, done. thanks
t/admin/schema-validate.t
Outdated
|
||
=== TEST 14: Test route upstream | ||
--- request | ||
GET /ip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check the response body, like this
=== TEST 8: `url` exist and `route_id` is 1
--- request
GET /hello
--- response_body
hello world
@theweakgod Nice job! |
^ ^. thank you very much for your help. |
Description
there is a bug in the schema check of nodes when admin-api saves the upstream configuration.
Fixes # (issue)
Checklist