-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Understand Gradle 4.8 test failure around setup of security policies #31324
Comments
Pinging @elastic/es-core-infra |
the problem is not reproducible with a change such as to alter task ordering:
|
I can confirm the root issue is indeed that we are running the tests with the Gradle runner. In fact all the test tasks are with the Gradle runner instead of |
Really!? Some of them looked right to me. Weird! |
I extended the randomized test runner plugin to include a sanity check (commit is d6e4c56, not pushed as of this writing) with this, the problem reproduces in ~15 seconds. I then tried to isolate it in https://github.com/atorok/gradle48_jdk11_replace_task and with this I found that it also reproduces on JDK 10, but apparently less frequently. That means we should have seen it in CI already. I'm not sure why we didn't. Maybe it was such a rare occurrence that it was discounted, or the frequency at which it occurs for the ES build vs. my isolated build is much lower. I'll submit an issue for Gradle, but from the forums I take it that the task replacement is fuzzy and bound to break, there are some APIs but it's not quite a finished feature. @nik9000 My previous comment is not quite right. I assumed many = all, but it's the case, e.x. from 3 runs I just did, first one had 44 wrong test task, the second one had none, the third one had 42. |
The reason we are not seeing this in CI is that it's specific to Gradle 4.8 |
Maybe we should be thinking of creating a task with a different name than Ideally to make this totally clean, it would be nice to rename the source sets and create source sets for integration tests as well. So we have |
Making a If we're doing something fundamentally against the way gradle wants to work then I think it'd be worth looking into but I don't think we are. |
Hmmm. I wonder if we could stop the java task from adding the test task in the first place. Moving the source sets would do it but it seems like a big change for what ought to be a smaller problem. But gradle.... |
Moving around the source sets is not a must. We can start just with a name
change. I wanted to look into not creating test at all but ran out of time.
I know there's a base Java plugin which we can use as long as we
re-implement parts of the config, we should be able to pull it off, but it
will add even more specialization to our already specialized build. I don't
particularly like that we are replacing a gradle convention with something
incompatible with it as the props on the random test runner are different.
…On Tue, Jun 19, 2018, 16:36 Nik Everett ***@***.***> wrote:
Hmmm. I wonder if we could stop the java task from adding the test task in
the first place. Moving the source sets would do it but it seems like a big
change for what ought to be a smaller problem. But gradle....
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#31324 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACcmFIPuzna-HEyHUm-0-ZBWjxrY_1L-ks5t-P5VgaJpZM4Unjy0>
.
|
java-base doesn't help much as it only brings the concept of source sets. Looking at how the Java plugin is implemented, there's no way to prevent it from creating I think the best way forward is to disable the |
Relates to #31324. It seems like Gradle has an inconsistent behavior and the taks is not always replaced.
Closes #31324. The issue has full context in comments. With this change the `test` task becomes nothing more than an alias for `utest`. Some of the stand alone tests that had a `test` task now have `integTest`, and a few of them that used to have `integTest` to run multiple tests now only have `check`. This will also help separarate unit/micro tests from integration tests.
Based on information from gradle/gradle#5730 replace the task taking into account the task providres. Closes #31324.
Thanks to additional diagnostics and information provided by gradle/gradle#5730, we now have a working implementation that replaces the test task. #31496 will help us move in the direction of using the Gradle runner. |
Relates to elastic#31324. It seems like Gradle has an inconsistent behavior and the taks is not always replaced.
Closes elastic#31324. The issue has full context in comments. With this change the `test` task becomes nothing more than an alias for `utest`. Some of the stand alone tests that had a `test` task now have `integTest`, and a few of them that used to have `integTest` to run multiple tests now only have `check`. This will also help separarate unit/micro tests from integration tests.
Based on information from gradle/gradle#5730 replace the task taking into account the task providres. Closes elastic#31324.
* Move to Gradle 4.8 RC1 * Use latest version of plugin The current does not work with Gradle 4.8 RC1 * Switch to Gradle GA * Add and configure build compare plugin * add work-around for gradle/gradle#5692 * work around gradle/gradle#5696 * Make use of Gradle build compare with reference project * Make the manifest more compare friendly * Clear the manifest in compare friendly mode * Remove animalsniffer from buildscript classpath * Fix javadoc errors * Fix doc issues * reference Gradle issues in comments * Conditionally configure build compare * Fix some more doclint issues * fix typo in build script * Add sanity check to make sure the test task was replaced Relates to #31324. It seems like Gradle has an inconsistent behavior and the taks is not always replaced. * Include number of non conforming tasks in the exception. * No longer replace test task, create implicit instead Closes #31324. The issue has full context in comments. With this change the `test` task becomes nothing more than an alias for `utest`. Some of the stand alone tests that had a `test` task now have `integTest`, and a few of them that used to have `integTest` to run multiple tests now only have `check`. This will also help separarate unit/micro tests from integration tests. * Revert "No longer replace test task, create implicit instead" This reverts commit f1ebaf7. * Fix replacement of the test task Based on information from gradle/gradle#5730 replace the task taking into account the task providres. Closes #31324. * Only apply build comapare plugin if needed * Make sure test runs before integTest * Fix doclint aftter merge * PR review comments * Switch to Gradle 4.8.1 and remove workaround * PR review comments * Consolidate task ordering
With Gradle 4.8 running on JDK 10 this happens (reformatted for readability):
then most other tests fail with something like:
The reading of policies from
Security
is done trough astatic {}
block inBootstrapForTesting
which should guarantee that it is only initialized once. There doesn't seem to be any other code paths that exercise this, the only timeSecurity.readPolicy
is inBootstrapForTesting
andBootstrap
that starts Elasticsearch, even if the tests were to do that, it doesn't have a chance to run before the tests are bootstrap.It must be some strange intimacy between Gradle 4.8 and JDK 10
OpenJDK Runtime Environment (build 10.0.1+10)
in my case, as the issue only reproduces with:./gradlew clean check
It does not reproduce with:
./gradlew :server:test
./gradlew :server:test
ran 100 timesOpenJDK Runtime Environment 18.9 (build 11-ea+17)
)Gradle seems to change the order of tasks a lot and will run many other tasks, including some tests before the
:server:tests
( which probably doesn't make sense ). Not sure this is relevant.In order to be able to move to the new Gradle version #31271 has a work around.
I'm writhing this up in the hopes of revisiting it to provide more clarity.
Note that as of this writing the Gradle 4.8 PR mentioned above is not merged.
Relates to #31230.
The text was updated successfully, but these errors were encountered: