Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-17650: Fix tests for unordered buffered updates #3197

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HoustonPutman
Copy link
Contributor

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

According to the discussion in the JIRA, the behavior here is fine. We just need to update the tests now that buffered updates can be done in parallel.

The new testing stuff is heavy handed, but mostly needed to 1) test this at all and 2) give us a good error message that we can actually use.

import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;

public class SolrMatchers {
Copy link
Contributor

Choose a reason for hiding this comment

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

add a bit of javadoc please. Like reference "Hamcrest", and javadoc on the subListMatches method.

Comment on lines +1050 to +1052
SolrParams params = null;
try {
params = req.getParams();
Copy link
Contributor

Choose a reason for hiding this comment

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

you could get & set at the declaration rather than split across the try. Could then be final.

* @return The request response as a JSON String if the test matcher passes
*/
@SuppressWarnings("unchecked")
public static <T> String assertThatJQ(SolrQueryRequest req, String message, Matcher<T> test)
Copy link
Contributor

Choose a reason for hiding this comment

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

You are adding more methods that uses the almost but not quite yet deprecated TestHarness. Can you please instead consider changing the approach of this method to look like org.apache.solr.SolrTestCaseHS#assertJQ which takes a SolrClient? Let's say you agree to do that. My next thought is... should SolrTestCase have such extensive utility methods or should they live on a helper class (a new one I guess). I lean to the latter but I haven't thought about that much yet.

Copy link
Member

@markrmiller markrmiller left a comment

Choose a reason for hiding this comment

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

Very nice PR!


public class SolrMatchers {

public static <T> Matcher<List<? extends T>> subListMatches(
Copy link
Member

Choose a reason for hiding this comment

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

Could add "Matches a segment of a list between two indices against a provided matcher, useful for checking ordered sub-sequences in a larger list"

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.

3 participants