Integration test with opensearch and Test Container

Hello everyone,
I’m working on an integration test in my java application using TestContainer to deploy a temporary opensearch envirovment.

Unfortunately my test case require an initialization of an index with a lot of documents (let’s say 1M).

I’m trying to indexing this data performing a “_bulk” request for 50K docs in ndjson body format with lowlevel client. This operation require a lot of time on my machine probably 30 min or more (I wasn’t able to finish the startup). At this point I’m here to ask you: which is the best way to achive this?

My idea is to create a replicable test but at this point I’m not sure that can be done.

I’m listening for every suggestion or tools that I don’t know.
Thanks

Hi @jluca ,

I would suggest at least 2 approaches to consider:

  • prepare snapshot and restore the container’s data from the snapshot before running tests
  • prepare own image with desired OpenSearch version and the data so container starts with data

Thank you.

Thank you @reta for your answer.
I think that the snapshot solution you suggest is the way as It’s possible to replicate the complete envirovment in 30 seconds.

Thank you again