Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take write lock on global provider in EvpKeyFactoryTest
We've recently seen some internal dry-run build failures, likely due to increased concurrency on beefy internal build hosts (see [here][1] and [here][2]). These failures manifested with this tell-tale signature: ``` JUnit Jupiter:EvpKeyFactoryTest:ecPrivate(KeyPair, String, boolean):EC-521, Translate: false MethodSource [className = 'com.amazon.nativejcebindings.test.EvpKeyFactoryTest', methodName = 'ecPrivate', methodParameterTypes = 'java.security.KeyPair, java.lang.String, boolean'] => org.opentest4j.AssertionFailedError: expected: <sun.security.ec.ECPrivateKeyImpl@ffff6867> but was: <com.amazon.nativejcebindings.EvpEcPrivateKey@ffff65db> ... com.amazon.nativejcebindings.test.EvpKeyFactoryTest.getSamples(EvpKeyFactoryTest.java:414) com.amazon.nativejcebindings.test.EvpKeyFactoryTest.ecPrivate(EvpKeyFactoryTest.java:298) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... JUnit Jupiter:EvpKeyFactoryTest:ecPrivate(KeyPair, String, boolean):EC-521, Translate: true MethodSource [className = 'com.amazon.nativejcebindings.test.EvpKeyFactoryTest', methodName = 'ecPrivate', methodParameterTypes = 'java.security.KeyPair, java.lang.String, boolean'] => org.opentest4j.AssertionFailedError: expected: <sun.security.ec.ECPrivateKeyImpl@ffff6867> but was: <com.amazon.nativejcebindings.EvpEcPrivateKey@ffff65db> ... com.amazon.nativejcebindings.test.EvpKeyFactoryTest.getSamples(EvpKeyFactoryTest.java:414) com.amazon.nativejcebindings.test.EvpKeyFactoryTest.ecPrivate(EvpKeyFactoryTest.java:298) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... JUnit Jupiter:EvpKeyFactoryTest:ecPrivateKeySpec(KeyPair, String):EC-521 MethodSource [className = 'com.amazon.nativejcebindings.test.EvpKeyFactoryTest', methodName = 'ecPrivateKeySpec', methodParameterTypes = 'java.security.KeyPair, java.lang.String'] => org.opentest4j.AssertionFailedError: Encoded ==> array lengths differ, expected: <97> but was: <98> ... com.amazon.nativejcebindings.test.EvpKeyFactoryTest.getSamples(EvpKeyFactoryTest.java:484) com.amazon.nativejcebindings.test.EvpKeyFactoryTest.ecPrivateKeySpec(EvpKeyFactoryTest.java:314) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... ``` So, we take a write lock on the global provider to ensure no other concurrently executing test is polluting the EvpKeyFactoryTest's JVM provider state. [1]: https://build.amazon.com/6039753402 [2]: https://build.amazon.com/6039762971
- Loading branch information