-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
*: add detailed error message on URLs equal check #9210
Conversation
/cc @hongchaodeng |
Codecov Report
@@ Coverage Diff @@
## master #9210 +/- ##
==========================================
- Coverage 76.06% 75.91% -0.15%
==========================================
Files 363 363
Lines 30161 30165 +4
==========================================
- Hits 22941 22900 -41
- Misses 5625 5664 +39
- Partials 1595 1601 +6
Continue to review full report at Codecov.
|
It would be more helpful to show why it doesn't match. Because from the message they are the same |
…URLs Signed-off-by: Gyuho Lee <[email protected]>
@hongchaodeng @fanminshi PTAL. Now we provide detailed error messages (which URL failed to be resolved and how). |
pkg/netutil/netutil.go
Outdated
@@ -121,49 +122,62 @@ func resolveURL(ctx context.Context, u url.URL) (string, error) { | |||
return "", ctx.Err() | |||
} | |||
|
|||
func sprintURLs(us []url.URL) []string { |
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.
maybe change name to urlsToStrings
? i think sprintURLs
is specific to go's fmt naming.
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.
Fixed.
@@ -182,11 +183,13 @@ func TestURLsEqual(t *testing.T) { | |||
a: []url.URL{{Scheme: "http", Host: "example.com:2379"}}, | |||
b: []url.URL{{Scheme: "https", Host: "10.0.10.1:2379"}}, | |||
expect: false, | |||
err: errors.New(`"http://10.0.10.1:2379"(resolved from "http://example.com:2379") != "https://10.0.10.1:2379"(resolved from "https://10.0.10.1:2379")`), |
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.
hmm, http://10.0.10.1:2379
from http://example.com:2379
do ==
to https://10.0.10.1:2379
(resolved from "https://10.0.10.1:2379"
) ?
I am not sure why this test fails.
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.
Scheme is different :)
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.
oh, i see now. sorry i didn't notice the scheme change.
}, | ||
{ | ||
a: []url.URL{{Scheme: "https", Host: "example.com:2379"}}, | ||
b: []url.URL{{Scheme: "http", Host: "10.0.10.1:2379"}}, | ||
expect: false, | ||
err: errors.New(`"https://10.0.10.1:2379"(resolved from "https://example.com:2379") != "http://10.0.10.1:2379"(resolved from "http://10.0.10.1:2379")`), |
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.
same here https://10.0.10.1:2379
== http://10.0.10.1:2379
?
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
lgtm thanks! |
LGTM. Thanks! |
--initial-cluster
flag.--initial-advertise-peer-urls
against corresponding--initial-cluster
URLs with forward-lookup.--initial-advertise-peer-urls
and--initial-cluster
do not match (e.g. due to DNS error), etcd will exit with errors."--initial-cluster must include s1=https://s1.test:2380 given --initial-advertise-peer-urls=https://s1.test:2380"
."--initial-advertise-peer-urls has https://s1.test:2380 but missing from --initial-cluster="
(DNS returns zero results).failed to resolve https://s1.test:2380 to match --initial-cluster=s1=https://s1.test:2380 (failed to resolve "https://s1.test:2380" (error x))
.For #9180.