Ensure global test seed is used for all random testing tasks#38991
Merged
mark-vieira merged 2 commits intoelastic:masterfrom Feb 16, 2019
Merged
Ensure global test seed is used for all random testing tasks#38991mark-vieira merged 2 commits intoelastic:masterfrom
mark-vieira merged 2 commits intoelastic:masterfrom
Conversation
This commit fixes a bug which resulted in every RandomizedTestingTask generating its own unique test seed rather than using the global test seed generated by the the RandomizedTestingPlugin. The issue didn't affect build invocations which explicitly ran with -Dtest.seed. In those cases, the Ant junit task correctly uses the global seed. Since the Ant random testing target looks for an Ant project property for determining the existing seed we now explicitly set this inside RandomizedTestingPlugin. It just so happens that, incidentally, Ant will inherit system properties, thus wy the -Dtest.seed mechanism continued to work.
Collaborator
|
Pinging @elastic/es-core-infra |
Contributor
Author
|
@elasticmachine retest this please |
rjernst
approved these changes
Feb 15, 2019
|
|
||
| void apply(Project project) { | ||
| setupSeed(project) | ||
| def seed = setupSeed(project) |
Member
There was a problem hiding this comment.
we try to use concrete types, as it makes it easier to port these classes to java (which we have slowly been doing).
Contributor
Author
There was a problem hiding this comment.
Then when we port from Java -> Kotlin we'll have to change back to val 😉
Contributor
Author
There was a problem hiding this comment.
☝️ joking about porting to Kotlin FYI 😆
jasontedor
added a commit
to jasontedor/elasticsearch
that referenced
this pull request
Feb 16, 2019
* elastic/master: Ensure global test seed is used for all random testing tasks (elastic#38991) re-mutes SmokeTestWatcherWithSecurityIT (elastic#38995) Rollup jobs should be cleaned up before indices are deleted (elastic#38930) relax ML Info Docs expected response (elastic#38993) Re-enable single node tests (elastic#38852) ClusterClientIT refactor (elastic#38872) Fix typo in Index API doc Edits to text & formatting in Term Suggester doc (elastic#38963) (elastic#38989) Migrate Streamable to Writeable for WatchStatus (elastic#37390)
mark-vieira
added a commit
to mark-vieira/elasticsearch
that referenced
this pull request
Feb 20, 2019
…#38991) This commit fixes a bug which resulted in every RandomizedTestingTask generating its own unique test seed rather than using the global test seed generated by the the RandomizedTestingPlugin. The issue didn't affect build invocations which explicitly ran with -Dtest.seed. In those cases, the Ant junit task correctly uses the global seed. Since the Ant random testing target looks for an Ant project property for determining the existing seed we now explicitly set this inside RandomizedTestingPlugin. It just so happens that, incidentally, Ant will inherit system properties, thus wy the -Dtest.seed mechanism continued to work. * Use explicit type
mark-vieira
added a commit
to mark-vieira/elasticsearch
that referenced
this pull request
Feb 20, 2019
…#38991) This commit fixes a bug which resulted in every RandomizedTestingTask generating its own unique test seed rather than using the global test seed generated by the the RandomizedTestingPlugin. The issue didn't affect build invocations which explicitly ran with -Dtest.seed. In those cases, the Ant junit task correctly uses the global seed. Since the Ant random testing target looks for an Ant project property for determining the existing seed we now explicitly set this inside RandomizedTestingPlugin. It just so happens that, incidentally, Ant will inherit system properties, thus wy the -Dtest.seed mechanism continued to work. * Use explicit type
mark-vieira
added a commit
to mark-vieira/elasticsearch
that referenced
this pull request
Feb 21, 2019
…#38991) This commit fixes a bug which resulted in every RandomizedTestingTask generating its own unique test seed rather than using the global test seed generated by the the RandomizedTestingPlugin. The issue didn't affect build invocations which explicitly ran with -Dtest.seed. In those cases, the Ant junit task correctly uses the global seed. Since the Ant random testing target looks for an Ant project property for determining the existing seed we now explicitly set this inside RandomizedTestingPlugin. It just so happens that, incidentally, Ant will inherit system properties, thus wy the -Dtest.seed mechanism continued to work. * Use explicit type
mark-vieira
added a commit
that referenced
this pull request
Feb 21, 2019
…#39196) This commit fixes a bug which resulted in every RandomizedTestingTask generating its own unique test seed rather than using the global test seed generated by the the RandomizedTestingPlugin. The issue didn't affect build invocations which explicitly ran with -Dtest.seed. In those cases, the Ant junit task correctly uses the global seed. Since the Ant random testing target looks for an Ant project property for determining the existing seed we now explicitly set this inside RandomizedTestingPlugin. It just so happens that, incidentally, Ant will inherit system properties, thus wy the -Dtest.seed mechanism continued to work. * Use explicit type
mark-vieira
added a commit
that referenced
this pull request
Feb 21, 2019
…#39197) This commit fixes a bug which resulted in every RandomizedTestingTask generating its own unique test seed rather than using the global test seed generated by the the RandomizedTestingPlugin. The issue didn't affect build invocations which explicitly ran with -Dtest.seed. In those cases, the Ant junit task correctly uses the global seed. Since the Ant random testing target looks for an Ant project property for determining the existing seed we now explicitly set this inside RandomizedTestingPlugin. It just so happens that, incidentally, Ant will inherit system properties, thus wy the -Dtest.seed mechanism continued to work. * Use explicit type
mark-vieira
added a commit
that referenced
this pull request
Feb 21, 2019
…#39195) This commit fixes a bug which resulted in every RandomizedTestingTask generating its own unique test seed rather than using the global test seed generated by the the RandomizedTestingPlugin. The issue didn't affect build invocations which explicitly ran with -Dtest.seed. In those cases, the Ant junit task correctly uses the global seed. Since the Ant random testing target looks for an Ant project property for determining the existing seed we now explicitly set this inside RandomizedTestingPlugin. It just so happens that, incidentally, Ant will inherit system properties, thus wy the -Dtest.seed mechanism continued to work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recently it was noticed that the global generated test seed reported at the beginning of every Gradle build was not always used for subsequent test tasks. For example:
As you can see, the global seed
DA01B1B09A1CDA37is not the same as the seed4804DC280933D0C4used by the:server:integTestTask.It turns out the reason for this is an implementation detail in how the Ant
junit4task works.In this case it looks for an Ant project property, and if not defined, falls back to generating a new seed.
We currently rely on explicitly setting the
test.seedsystem property on the test task here but this actually gets ignored when the forked test VMs are created and the randomly generated seed (created above) is used instead.While investigating it was noticed that invoking the build with an explicit seed (ex:
./gradlew -Dtest.seed=foo) does result in the behavior we want, which is that all random test tasks in the build use the global seed. The reason for this is that all build system properties are inherited by Ant as project properties.This PR simply unifies these behaviors such that when the global seed is generated as part of the build (not specified on the commandline) we explicitly set the appropriate Ant project property to ensure this propagates to any and all Ant tasks.