-
Notifications
You must be signed in to change notification settings - Fork 851
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
Randomize test ports #6915
Randomize test ports #6915
Conversation
d577e22
to
a73b5f8
Compare
a73b5f8
to
0dc1437
Compare
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.
Approved with a few comments. Thanks!
tests/testcore/onebox.go
Outdated
@@ -949,3 +893,15 @@ func (c *TemporalImpl) overrideDynamicConfig(t *testing.T, name dynamicconfig.Ke | |||
t.Cleanup(cleanup) | |||
return cleanup | |||
} | |||
|
|||
func portFromAddress(addr string) httpPort { |
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 must
to clarify that this panics.
func portFromAddress(addr string) httpPort { | |
func mustPortFromAddress(addr string) httpPort { |
tests/testcore/test_cluster.go
Outdated
// allocate ports | ||
pp := temporalite.NewPortProvider() | ||
hostsByProtocolByService := map[transferProtocol]map[primitives.ServiceName]static.Hosts{ | ||
grpcProtocol: map[primitives.ServiceName]static.Hosts{ |
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.
grpcProtocol: map[primitives.ServiceName]static.Hosts{ | |
grpcProtocol: { |
tests/testcore/test_cluster.go
Outdated
pp := temporalite.NewPortProvider() | ||
hostsByProtocolByService := map[transferProtocol]map[primitives.ServiceName]static.Hosts{ | ||
grpcProtocol: map[primitives.ServiceName]static.Hosts{ | ||
primitives.FrontendService: static.Hosts{All: makeAddresses(pp, options.FrontendConfig.NumFrontendHosts)}, |
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.
primitives.FrontendService: static.Hosts{All: makeAddresses(pp, options.FrontendConfig.NumFrontendHosts)}, | |
primitives.FrontendService: {All: makeAddresses(pp, options.FrontendConfig.NumFrontendHosts)}, |
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.
Ha, I wonder why (my) Goland doesn't highlight this as redundant.
What changed?
Instead of using fixed ports in functional tests, use randomized ports.
The nested map is ... not pretty but effective. Happy to throw more design at it, if needed.
Why?
When starting two or more clusters (e.g. xdc tests), different hosts have to be used for the ports not to collide; which causes issues on at least MacOS.
How did you test it?
Existing tests.
Potential risks
Documentation
Is hotfix candidate?