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
Find free hub port to support multiple local grids in common environments #275
Conversation
int configHubPort = Integer.parseInt(Config.getConfigProperty(ConfigProperty.SELENIUM_PORT)); | ||
// Choose another free port when config port is not available. | ||
int hubPort = PortProber.pollPort(configHubPort) ? configHubPort : PortProber.findFreePort(); | ||
instance.setPort(hubPort); |
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.
Should we update the value of the property SELENIUM_PORT if we are not using 4444?
cf88513
to
ada8a81
Compare
instance.setPort(Integer.parseInt(Config.getConfigProperty(ConfigProperty.SELENIUM_PORT))); | ||
int configHubPort = Integer.parseInt(Config.getConfigProperty(ConfigProperty.SELENIUM_PORT)); | ||
// Choose another free port when config port is not available. | ||
int hubPort = LocalHub.pollPort(configHubPort) ? configHubPort : PortProber.findFreePort(); |
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.
I was able to fix my development environment and test this change. The PortProber.pollPort(int)
returned true even when another grid was already running at port 4444. Hence add a private static method in LocalHub
.
Updated changes in ada8a81. |
@shelar I liked the previous version of this PR more. If we are starting a |
@mach6 I agree with the 'always random port' option too. Will update changes shortly. |
54808e4
to
93e2410
Compare
Updated changes to always use random port for hub - 93e2410. |
please increment date range of copyright header. |
Will you please update the javadocs for |
Fix for #274 |
…n environment. Closes paypal#274
Added |
LGTM too. merging |
Amended commit message and merged. |
Added a check to see whether the hub port in configuration is available.
Find a another free port when the hub port in the configuration is occupied.
I have not been able to test it for some reasons specific to my env.