- Notifications
You must be signed in to change notification settings - Fork928
chore: consolidate various randomPort() implementations#12362
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
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.
just a digression on naming, otherwise 👍
@@ -838,7 +837,7 @@ func TestAgent_TCPRemoteForwarding(t *testing.T) { | |||
var ll net.Listener | |||
var err error | |||
for { | |||
randomPort =pickRandomPort() | |||
randomPort =testutil.RandomPortNoListen(t) |
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.
nit:testutil.FreePort
?
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.
This one isn't guaranteed to be free and relies on pure randommess.
Regarding the other implementation, I just picked the existing name.
We can rename later if need be. 👍
Consolidates our existing
randomPort()
implementations totestutil.RandomPort(NoListen)?
.