-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Use unique ports per test worker #43983
Conversation
Pinging @elastic/es-core-infra |
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.
LGTM
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.
Great find! I wonder if we could fail if we can't find this property? If gradle changes something, we should fail fast instead of silently going on like we have for these months since moving the runner from randomized testing.
I've added testing for this now. As I wasn't exactly sure where to put what, please have a look and let me know what you think. |
I don't think we should care about the tests.gradle sysprops. Iirc we set that ourselves. Why couldn't we error if the sysprop you are checking for the gradle worker doesn't exist? |
This reverts commit 2fee751.
alright, I missed that.
We still want to be able to run tests from the IDE. If we always require |
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.
LGTM
Great find !
I forgot to say here that the credits go to @henningandersen. He pointed me to this while looking at #43970. |
* Use unique ports per test worker * Add test for system property * check presence of tests.gradle * Revert "check presence of tests.gradle" This reverts commit 2fee751.
* Use unique ports per test worker * Add test for system property * check presence of tests.gradle * Revert "check presence of tests.gradle" This reverts commit 2fee751.
This is awesome. Great find indeed. I had no idea that Gradle injected that system property into tests. |
Relates to elastic#43983 The IDs gradle uses are incremented for the lifetime of the daemon which can result in port ranges that are outside the valid range. This change implements a modulo based formula to wrap the port ranges when the IDs get too large. Adresses elastic#44134 but elastic#44157 is also required to be able to close it.
* Fix port range allocation with large worker IDs Relates to #43983 The IDs gradle uses are incremented for the lifetime of the daemon which can result in port ranges that are outside the valid range. This change implements a modulo based formula to wrap the port ranges when the IDs get too large. Adresses #44134 but #44157 is also required to be able to close it.
* Fix port range allocation with large worker IDs Relates to #43983 The IDs gradle uses are incremented for the lifetime of the daemon which can result in port ranges that are outside the valid range. This change implements a modulo based formula to wrap the port ranges when the IDs get too large. Adresses #44134 but #44157 is also required to be able to close it.
* Fix port range allocation with large worker IDs Relates to #43983 The IDs gradle uses are incremented for the lifetime of the daemon which can result in port ranges that are outside the valid range. This change implements a modulo based formula to wrap the port ranges when the IDs get too large. Adresses #44134 but #44157 is also required to be able to close it.
A recent PR to replace the randomized testing task by Gradle's test task broke a property used by our tests to distinguish between different parallel test processes and allocate separate port ranges for those parallel JVMs so that the tests would not communicate with each other. This has caused failures like #41067 where tests from different JVMs are now interacting with each other.
As tests are now executed with the regular Gradle runner, this PR now switches to the logic that recognizes different test processes with the help of the
org.gradle.test.worker
system property, which is unique for each process, see https://docs.gradle.org/current/userguide/java_testing.html