Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
risdenk committed Jan 22, 2024
1 parent 8c318fd commit 962f35a
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions solr/core/src/test/org/apache/solr/search/TestMainQueryCaching.java
Expand Up @@ -38,7 +38,7 @@
public class TestMainQueryCaching extends SolrTestCaseJ4 {

private static final int MOST_DOCS = 100;
private static final int ALL_DOCS = MOST_DOCS + 1;
private static final long ALL_DOCS = MOST_DOCS + 1;
private static final String TEST_UFFSQ_PROPNAME = "solr.test.useFilterForSortedQuery";
static String RESTORE_UFFSQ_PROP;
private static final String TEST_QRC_WINDOW_SIZE_PROPNAME = "solr.test.queryResultWindowSize";
Expand Down Expand Up @@ -77,7 +77,7 @@ public static void createIndex() {
}
}
// add an extra doc to distinguish scoring query from `*:*`
assertU(adoc("id", Integer.toString(MOST_DOCS), "str", "e" + MOST_DOCS));
assertU(adoc("id", Long.toString(MOST_DOCS), "str", "e" + MOST_DOCS));
assertU(commit());
}

Expand All @@ -102,8 +102,8 @@ private static long coreToInserts(SolrCore core, String cacheName) {
}

private static long coreToSortCount(SolrCore core, String skipOrFull) {
return (long)
((SolrMetricManager.GaugeWrapper<?>)
return
((SolrMetricManager.GaugeWrapper<Long>)
core.getCoreMetricManager()
.getRegistry()
.getMetrics()
Expand Down Expand Up @@ -261,7 +261,7 @@ private static void assertMetricCounts(String response, int[] expectCounters) {
assertEquals("Bad matchAllDocs insert count", 1, coreToMatchAllDocsInsertCount(core));
assertEquals("Bad filterCache insert count", 0, coreToInserts(core, "filterCache"));
assertEquals("Bad full sort count", 0, coreToSortCount(core, "full"));
assertEquals("Should have exactly " + ALL_DOCS, ALL_DOCS, (long) (body.get("numFound")));
assertEquals("Should have exactly " + ALL_DOCS, ALL_DOCS, (body.get("numFound")));
long queryCacheInsertCount = coreToInserts(core, "queryResultCache");
if (queryCacheInsertCount == expectCounters[0]) {
// should be a hit, so all insert/sort-count metrics remain unchanged.
Expand Down Expand Up @@ -329,7 +329,7 @@ public void testCursorMark() throws Exception {
"*",
"sort",
includeScoreInSort ? "score desc,id asc" : "id asc"));
final int expectNumFound = MATCH_ALL_DOCS_QUERY.equals(q) ? ALL_DOCS : MOST_DOCS;
final long expectNumFound = MATCH_ALL_DOCS_QUERY.equals(q) ? ALL_DOCS : MOST_DOCS;
final boolean consultMatchAllDocs;
final boolean insertFilterCache;
if (includeScoreInSort) {
Expand Down Expand Up @@ -385,9 +385,9 @@ public void testCursorMarkZeroRows() throws Exception {
private static void assertMetricCounts(
String response,
boolean matchAllDocs,
int expectFilterCacheInsertCount,
int expectFullSortCount,
int expectSkipSortCount) {
long expectFilterCacheInsertCount,
long expectFullSortCount,
long expectSkipSortCount) {
assertMetricCounts(
response,
matchAllDocs,
Expand All @@ -400,10 +400,10 @@ private static void assertMetricCounts(
private static void assertMetricCounts(
String response,
boolean matchAllDocs,
int expectFilterCacheInsertCount,
int expectFullSortCount,
int expectSkipSortCount,
int expectNumFound) {
long expectFilterCacheInsertCount,
long expectFullSortCount,
long expectSkipSortCount,
long expectNumFound) {
Map<?, ?> res = (Map<?, ?>) fromJSONString(response);
Map<?, ?> body = (Map<?, ?>) (res.get("response"));
SolrCore core = h.getCore();
Expand All @@ -418,7 +418,7 @@ private static void assertMetricCounts(
assertEquals("Bad full sort count", expectFullSortCount, coreToSortCount(core, "full"));
assertEquals("Bad skip sort count", expectSkipSortCount, coreToSortCount(core, "skip"));
assertEquals(
"Should have exactly " + expectNumFound, expectNumFound, (long) (body.get("numFound")));
"Should have exactly " + expectNumFound, expectNumFound, (body.get("numFound")));
}

@Test
Expand Down Expand Up @@ -453,7 +453,7 @@ queryResultCache, which can interfere with DocSet fetching (which
Map<?, ?> res = (Map<?, ?>) fromJSONString(response);
Map<?, ?> body = (Map<?, ?>) (res.get("response"));
assertEquals(
"Should have exactly " + ALL_DOCS, ALL_DOCS, (long) (body.get("numFound")));
"Should have exactly " + ALL_DOCS, ALL_DOCS, (body.get("numFound")));
} catch (Exception ex) {
throw new RuntimeException(ex);
}
Expand Down

0 comments on commit 962f35a

Please sign in to comment.