Integration tests fail with java.security.AccessControlException

I'm trying to run integration tests with Elasticsearch 5 by extending ESIntegTestCase in my class. However, it always fails with java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "setDefaultUncaughtExceptionHandler"), no matter what I try.

I have tried to set ES_JAVA_OPTS="-Dtests.security.manager=false" and ES_JAVA_OPTS="-Djava.security.policy=my_project/src/main/resources/plugin-security.policy". The file contains:
grant {
permission java.lang.RuntimePermission "setDefaultUncaughtExceptionHandler";
permission org.elasticsearch.ThreadPermission "modifyArbitraryThreadGroup";
};

https://www.elastic.co/guide/en/elasticsearch/plugins/5.0/plugin-authors.html asks to put plugin-security.policy in src/main/plugin-metadata, which I did, but I use Maven and the file does not get picked up, I guess. I could use Gradle as well if needed, but it's not clear what "Gradle build system" is and how to get that in my project?

I also tried to run the integration tests following the instructions in http://david.pilato.fr/blog/2016/10/18/elasticsearch-real-integration-tests-updated-for-ga/, but no luck.

How can I get testing work?

Replying to myself: I got it solved by including <argLine>-Dtests.security.manager=false</argLine> in randomizedtesting maven plugin configuration. Not sure why the policy file is not picked up, though.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.