-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Upgrade to JUnit 4.12 #23877
Upgrade to JUnit 4.12 #23877
Conversation
By curiosity, I was just trying today to upgrade JUnit to 4.12 but this is not straight forward as now the SM is complaining. ```sh gradle :test:framework:test -Dtests.jvm.argline="-Djava.security.debug=access,failure" ``` ``` java.lang.Exception: Stack trace 2> at java.lang.Thread.dumpStack(Thread.java:1333) 2> at java.security.AccessControlContext.checkPermission(AccessControlContext.java:462) 2> at java.security.AccessController.checkPermission(AccessController.java:884) 2> at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) 2> at java.lang.Class.checkMemberAccess(Class.java:2348) 2> at java.lang.Class.getDeclaredMethods(Class.java:1974) 2> at org.junit.internal.MethodSorter.getDeclaredMethods(MethodSorter.java:54) 2> at org.junit.runners.model.TestClass.scanAnnotatedMembers(TestClass.java:65) 2> at org.junit.runners.model.TestClass.<init>(TestClass.java:57) 2> at com.carrotsearch.randomizedtesting.RandomizedRunner$12.run(RandomizedRunner.java:1053) 2> at com.carrotsearch.randomizedtesting.RandomizedRunner$12.run(RandomizedRunner.java:1050) 2> at java.security.AccessController.doPrivileged(Native Method) 2> at com.carrotsearch.randomizedtesting.RandomizedRunner.getAnnotatedFieldValues(RandomizedRunner.java:1050) 2> at com.carrotsearch.randomizedtesting.RandomizedRunner.withClassRules(RandomizedRunner.java:885) 2> at com.carrotsearch.randomizedtesting.RandomizedRunner.runSuite(RandomizedRunner.java:674) 2> at com.carrotsearch.randomizedtesting.RandomizedRunner.access$200(RandomizedRunner.java:140) 2> at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:598) ``` Just opening this PR for now as a WIP. May be something super easy to fix...
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.
You have to grant java.lang.RuntimePermission "accessDeclaredMembers"
to JUnit 4.12 in test-framework.policy (replace what is already granted to JUnit 4.11). Also, you'll need to check if the junit4-ant dependency is updated and adjust accordingly.
Thanks @jasontedor Something looks strange to me about
Does it mean that we actually don't need anymore this policy? WDYT? |
I ran |
That permission is still listed in the example security policy for RR: |
The |
@rjernst and I looked at this more closely. The permission would be needed by the JVM that forks the slave JVMs. For us, this JVM does not run with a security manager, only the slave JVMs do in the common case. So, we in fact do not need this permission and it can remain removed. |
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.
Thanks @jasontedor and @rjernst. Do you think this should also go to 5.x branch? |
Yes. |
* Upgrade to JUnit 4.12 * Add permission to junit 4.12 and remove junit4-ant specific permission Backport of #23877 in 5.x branch
Pushed in master/5.x (5.5.0). Thanks! |
* master: (27 commits) Check index sorting with no replica since we cannot ensure that the replica index is ready when forceMerge is called. Closes elastic#24416 Docs: correct indentation on callout Build that java api docs from a test (elastic#24354) Move RemoteClusterService into TransportService (elastic#24424) Fix license header in WildflyIT.java Try not to lose stacktraces (elastic#24426) [DOCS] Update XPack Reference URL for 5.4 (elastic#24425) Painless: Add tests to check for existence and correct detection of the special Java 9 optimizations: Indified String concat and MethodHandles#ArrayLengthHelper() (elastic#24405) Extract a common base class to allow services to listen to remote cluster config updates (elastic#24367) Adds check to snapshot repository incompatible-snapshots blob to delete a pre-existing one before attempting to overwrite it. Added docs for batched_reduce_size Fixes checkstyle errors Allow scripted metric agg to access `_score` (elastic#24295) [Test] Add unit tests for HDR/TDigest PercentilesAggregators (elastic#24245) Fix FieldCaps documentation Upgrade to JUnit 4.12 (elastic#23877) Set available processors for Netty Painless: Fix method references to ctor with the new LambdaBootstrap and cleanup code (elastic#24406) Doc test: use propery regex for file size [DOCS] Tweak doc test to sync_flush ...
Release notes: https://github.com/junit-team/junit4/blob/master/doc/ReleaseNotes4.12.md