-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
grpc: Canonicalize string returned by ClientConn.Target() and resolver.Address.String() #6923
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #6923 +/- ##
==========================================
- Coverage 83.51% 82.34% -1.18%
==========================================
Files 287 296 +9
Lines 30920 31453 +533
==========================================
+ Hits 25824 25900 +76
- Misses 4020 4491 +471
+ Partials 1076 1062 -14
|
Discussed offline; currently adding more test cases (and made a t-test) |
Change LGTM; let me know when you add more tests. |
Added a t-test. |
clientconn.go
Outdated
@@ -883,14 +883,14 @@ func (cc *ClientConn) channelzMetric() *channelz.ChannelInternalMetric { | |||
} | |||
} | |||
|
|||
// Target returns the target string of the ClientConn. | |||
// Target returns the canonicalized target string of the ClientConn. |
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.
Let's use "canonical" since "canonicalize" isn't a word.
Target returns the canonical target 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.
Done haha.
resolver/resolver.go
Outdated
@@ -283,7 +283,7 @@ func (t Target) Endpoint() string { | |||
|
|||
// String returns a string representation of Target. |
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.
add "canonical".
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.
Done.
clientconn_test.go
Outdated
{ | ||
name: "canonicalized-target-nonexistent", | ||
addr: "nonexist:///non.existent", | ||
targetWant: "passthrough:///nonexist:///non.existent", | ||
}, |
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.
Also test dns:hostname:port
->dns:///hostname:port
.
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.
Done.
resolver/resolver.go
Outdated
@@ -281,9 +281,9 @@ func (t Target) Endpoint() string { | |||
return strings.TrimPrefix(endpoint, "/") | |||
} | |||
|
|||
// String returns a string representation of Target. | |||
// String returns a canonical string representation of Target. |
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.
Super nit: "the canonical", please... there is only one canonical version of something.
This PR canoncializes the string returned from Target() on the ClientConn. This is a behavior change, but ok because API is marked experimental.
RELEASE NOTES: