Skip to content

Conversation

@epugh
Copy link
Contributor

@epugh epugh commented Jan 10, 2026

https://issues.apache.org/jira/browse/SOLR-18067

Description

Migrate to modern test infrastructure.

Solution

Asked Claude using same prompt as I used for the SolrJettyTestRule, however this went much faster/much simpler.

Now I get a bit why we like embedded ;-)

Tests

Re-ran the tests.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates test classes from the deprecated EmbeddedSolrServerTestBase base class to the modern EmbeddedSolrServerTestRule test rule pattern, modernizing the test infrastructure.

Changes:

  • Removed the deprecated EmbeddedSolrServerTestBase class
  • Migrated 8 test classes to use EmbeddedSolrServerTestRule with @ClassRule
  • Updated all references from getSolrClient() to solrTestRule.getSolrClient()

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
solr/test-framework/src/java/org/apache/solr/EmbeddedSolrServerTestBase.java Removed deprecated base class
solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java Migrated to use EmbeddedSolrServerTestRule
solr/solrj/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java Migrated to use EmbeddedSolrServerTestRule
solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DirectJsonQueryRequestFacetingEmbeddedTest.java Migrated to use EmbeddedSolrServerTestRule
solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrPingTest.java Migrated to use EmbeddedSolrServerTestRule
solr/solrj/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.java Migrated to use EmbeddedSolrServerTestRule
solr/solrj/src/test/org/apache/solr/client/solrj/GetByIdTest.java Migrated to use EmbeddedSolrServerTestRule
solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java Migrated to use EmbeddedSolrServerTestRule
solr/core/src/test/org/apache/solr/update/RootFieldTest.java Migrated to use EmbeddedSolrServerTestRule

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import org.junit.ClassRule;

@Deprecated // simply use EmbeddedSolrServerTestRule
public abstract class EmbeddedSolrServerTestBase extends SolrTestCase {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice this extends SolrTestCase. I definitely like that; STC is the futre, not STCJ4. Thus the tests you changed should subclass STC, not STCJ4.

@Before
public void before() throws SolrServerException, IOException {
getSolrClient().deleteByQuery("*:*");
solrTestRule.getSolrClient().deleteByQuery("*:*");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kinda wonder if STR.client() should exist to shorten our calls a bit more since everyone will want a client from STR; that's it's primary purpose in life.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question!!!

Still have the STCj4 as an import due to various methods called there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants