I'm working on an Elasticsearch plugin. I'm implementing an integration test that needs to pull something off the file system. It's a rather large blob of text and I'd rather not place it inline in the code. I'm using the esPlugin
gradle plugin. Which comes with many handy checks, including ensuring I'm not using any forbidden APIs.
The Java file i/o APIs appear to be forbidden. Instead, you're asked to use Elasticsearch's PathUtils utility class. This works fine in Intellij, however when I run the integration test from the command line (gradle integTest
) I get a file-not-found error. It seems the root file system for Elasticsearch is not the same place where my test resource was staged. Specifically, /build/testrun/integTest/J0/build/resources/test/model.txt
. You can see what I'm trying to do here.
I'm wondering what I, as an Elasticsearch plugin developer, am supposed to do to handle my own test resources. Should I
- Use some integTest#processTestResources that will stage this for me in the temp folder? (I can't seem to find such a task)
- Disable forbidden APIs for integTests?
- Use some other process I'm unfamiliar with?
Any help appreciated!