You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Uday Kumar <ud...@indiamart.com.INVALID> on 2025/07/11 08:18:08 UTC
Any way to spin up an in-memory Solr instance for executing integration tests?
Hi all,
Currently, we run Solr on a test server and use it during our integration
tests for Spring Batch Jobs. This server needs to be maintained and
make sure solr is up and running while executing test cases. For the
database connections, we use H2 in-memory DB, which works well because it's
fast and doesn’t need a separate server.
We would like to know if there’s any standard practice to spin up in-memory
solr— so we don’t have to rely on a separate Solr server during tests.
*fyi*
*versions used in production:Java: 1.8*
*Solr Cloud: v9.6*
*Thanks & Regards,*
*Uday Kumar*
*Product Search Tech*
Re: Any way to spin up an in-memory Solr instance for executing integration tests?
Posted by Uday Kumar <ud...@indiamart.com.INVALID>.
Hi mikhail,
Thanks, Will check this
*Thanks & Regards,*
*Uday Kumar*
*Product Search Tech*
On Fri, Jul 11, 2025, 16:44 Mikhail Khludnev <mk...@apache.org> wrote:
> For in-process tests developers use
>
> https://github.com/apache/solr/blob/5fafabdb13d62b2d590f7602b7720042e5f3a3db/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java#L83
> it might be a possible approach.
> Also you may experiment RAMDirectoryFactory in solrconfig.xml
>
> On Fri, Jul 11, 2025 at 1:13 PM Uday Kumar <uday.polu@indiamart.com
> .invalid>
> wrote:
>
> > Hi
> > Thanks for suggestions, will check these
> >
> > *Thanks & Regards,*
> > *Uday Kumar*
> > *Product Search Tech*
> >
> > On Fri, Jul 11, 2025, 14:08 Matthias Krüger <
> > mkrueger@opensourceconnections.com> wrote:
> >
> > > Two options:
> > > * For integration tests that use Solr "externally" start a Solr Docker
> > > container using TestContainers (e.g.
> > >
> > >
> >
> https://opensourceconnections.com/blog/2021/03/01/adding-integration-tests-to-a-solr-plugin-project/
> > > )
> > > * For integration tests that need to spin up SolrCloud but also need to
> > > have access to Solr internals write a SolrCloudTestCase (e.g.
> > >
> > >
> >
> https://github.com/apache/solr/blob/main/solr/solr-ref-guide/modules/indexing-guide/examples/IndexingNestedDocuments.java
> > > )
> > >
> > >
> > > On Fri, Jul 11, 2025 at 10:19 AM Uday Kumar <uday.polu@indiamart.com
> > > .invalid>
> > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > Currently, we run Solr on a test server and use it during our
> > integration
> > > > tests for Spring Batch Jobs. This server needs to be maintained and
> > > > make sure solr is up and running while executing test cases. For the
> > > > database connections, we use H2 in-memory DB, which works well
> because
> > > it's
> > > > fast and doesn’t need a separate server.
> > > >
> > > > We would like to know if there’s any standard practice to spin up
> > > in-memory
> > > > solr— so we don’t have to rely on a separate Solr server during
> tests.
> > > >
> > > > *fyi*
> > > >
> > > > *versions used in production:Java: 1.8*
> > > >
> > > > *Solr Cloud: v9.6*
> > > > *Thanks & Regards,*
> > > > *Uday Kumar*
> > > > *Product Search Tech*
> > > >
> > >
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>
Re: Any way to spin up an in-memory Solr instance for executing integration tests?
Posted by Mikhail Khludnev <mk...@apache.org>.
For in-process tests developers use
https://github.com/apache/solr/blob/5fafabdb13d62b2d590f7602b7720042e5f3a3db/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java#L83
it might be a possible approach.
Also you may experiment RAMDirectoryFactory in solrconfig.xml
On Fri, Jul 11, 2025 at 1:13 PM Uday Kumar <ud...@indiamart.com.invalid>
wrote:
> Hi
> Thanks for suggestions, will check these
>
> *Thanks & Regards,*
> *Uday Kumar*
> *Product Search Tech*
>
> On Fri, Jul 11, 2025, 14:08 Matthias Krüger <
> mkrueger@opensourceconnections.com> wrote:
>
> > Two options:
> > * For integration tests that use Solr "externally" start a Solr Docker
> > container using TestContainers (e.g.
> >
> >
> https://opensourceconnections.com/blog/2021/03/01/adding-integration-tests-to-a-solr-plugin-project/
> > )
> > * For integration tests that need to spin up SolrCloud but also need to
> > have access to Solr internals write a SolrCloudTestCase (e.g.
> >
> >
> https://github.com/apache/solr/blob/main/solr/solr-ref-guide/modules/indexing-guide/examples/IndexingNestedDocuments.java
> > )
> >
> >
> > On Fri, Jul 11, 2025 at 10:19 AM Uday Kumar <uday.polu@indiamart.com
> > .invalid>
> > wrote:
> >
> > > Hi all,
> > >
> > > Currently, we run Solr on a test server and use it during our
> integration
> > > tests for Spring Batch Jobs. This server needs to be maintained and
> > > make sure solr is up and running while executing test cases. For the
> > > database connections, we use H2 in-memory DB, which works well because
> > it's
> > > fast and doesn’t need a separate server.
> > >
> > > We would like to know if there’s any standard practice to spin up
> > in-memory
> > > solr— so we don’t have to rely on a separate Solr server during tests.
> > >
> > > *fyi*
> > >
> > > *versions used in production:Java: 1.8*
> > >
> > > *Solr Cloud: v9.6*
> > > *Thanks & Regards,*
> > > *Uday Kumar*
> > > *Product Search Tech*
> > >
> >
>
--
Sincerely yours
Mikhail Khludnev
Re: Any way to spin up an in-memory Solr instance for executing integration tests?
Posted by Uday Kumar <ud...@indiamart.com.INVALID>.
Hi
Thanks for suggestions, will check these
*Thanks & Regards,*
*Uday Kumar*
*Product Search Tech*
On Fri, Jul 11, 2025, 14:08 Matthias Krüger <
mkrueger@opensourceconnections.com> wrote:
> Two options:
> * For integration tests that use Solr "externally" start a Solr Docker
> container using TestContainers (e.g.
>
> https://opensourceconnections.com/blog/2021/03/01/adding-integration-tests-to-a-solr-plugin-project/
> )
> * For integration tests that need to spin up SolrCloud but also need to
> have access to Solr internals write a SolrCloudTestCase (e.g.
>
> https://github.com/apache/solr/blob/main/solr/solr-ref-guide/modules/indexing-guide/examples/IndexingNestedDocuments.java
> )
>
>
> On Fri, Jul 11, 2025 at 10:19 AM Uday Kumar <uday.polu@indiamart.com
> .invalid>
> wrote:
>
> > Hi all,
> >
> > Currently, we run Solr on a test server and use it during our integration
> > tests for Spring Batch Jobs. This server needs to be maintained and
> > make sure solr is up and running while executing test cases. For the
> > database connections, we use H2 in-memory DB, which works well because
> it's
> > fast and doesn’t need a separate server.
> >
> > We would like to know if there’s any standard practice to spin up
> in-memory
> > solr— so we don’t have to rely on a separate Solr server during tests.
> >
> > *fyi*
> >
> > *versions used in production:Java: 1.8*
> >
> > *Solr Cloud: v9.6*
> > *Thanks & Regards,*
> > *Uday Kumar*
> > *Product Search Tech*
> >
>
Re: Any way to spin up an in-memory Solr instance for executing integration tests?
Posted by Matthias Krüger <mk...@opensourceconnections.com>.
Two options:
* For integration tests that use Solr "externally" start a Solr Docker
container using TestContainers (e.g.
https://opensourceconnections.com/blog/2021/03/01/adding-integration-tests-to-a-solr-plugin-project/
)
* For integration tests that need to spin up SolrCloud but also need to
have access to Solr internals write a SolrCloudTestCase (e.g.
https://github.com/apache/solr/blob/main/solr/solr-ref-guide/modules/indexing-guide/examples/IndexingNestedDocuments.java
)
On Fri, Jul 11, 2025 at 10:19 AM Uday Kumar <ud...@indiamart.com.invalid>
wrote:
> Hi all,
>
> Currently, we run Solr on a test server and use it during our integration
> tests for Spring Batch Jobs. This server needs to be maintained and
> make sure solr is up and running while executing test cases. For the
> database connections, we use H2 in-memory DB, which works well because it's
> fast and doesn’t need a separate server.
>
> We would like to know if there’s any standard practice to spin up in-memory
> solr— so we don’t have to rely on a separate Solr server during tests.
>
> *fyi*
>
> *versions used in production:Java: 1.8*
>
> *Solr Cloud: v9.6*
> *Thanks & Regards,*
> *Uday Kumar*
> *Product Search Tech*
>