-
Notifications
You must be signed in to change notification settings - Fork 692
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
base: main
Are you sure you want to change the base?
Conversation
import org.hamcrest.Matcher; | ||
import org.hamcrest.TypeSafeDiagnosingMatcher; | ||
|
||
public class SolrMatchers { |
There was a problem hiding this comment.
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.
SolrParams params = null; | ||
try { | ||
params = req.getParams(); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this 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( |
There was a problem hiding this comment.
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"
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.