SOLR-12680: Fix ClassCastException and AIOOBE in TestSolrConfigHandlerConcurrent

This commit is contained in:
Shalin Shekhar Mangar 2018-08-20 13:25:56 +05:30
parent ee498f5a38
commit 20d0f67edd
2 changed files with 22 additions and 18 deletions

View File

@ -318,6 +318,8 @@ Other Changes
* SOLR-12014: Cryptic error message when creating a collection with sharding that violates autoscaling policies (noble) * SOLR-12014: Cryptic error message when creating a collection with sharding that violates autoscaling policies (noble)
* SOLR-12680: Fix ClassCastException and AIOOBE in TestSolrConfigHandlerConcurrent. (shalin)
================== 7.4.0 ================== ================== 7.4.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -65,22 +65,24 @@ public class TestSolrConfigHandlerConcurrent extends AbstractFullDistribZkTestBa
for (Object o : caches.entrySet()) { for (Object o : caches.entrySet()) {
final Map.Entry e = (Map.Entry) o; final Map.Entry e = (Map.Entry) o;
if (e.getValue() instanceof Map) {
Map value = (Map) e.getValue();
Thread t = new Thread() { Thread t = new Thread() {
@Override @Override
public void run() { public void run() {
try { try {
ArrayList errs = new ArrayList(); List<String> errs = new ArrayList<>();
collectErrors.add(errs); collectErrors.add(errs);
invokeBulkCall((String)e.getKey() , errs, (Map) e.getValue()); invokeBulkCall((String)e.getKey() , errs, value);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
}; };
threads.add(t); threads.add(t);
t.start(); t.start();
} }
}
for (Thread thread : threads) thread.join(); for (Thread thread : threads) thread.join();
@ -146,7 +148,7 @@ public class TestSolrConfigHandlerConcurrent extends AbstractFullDistribZkTestBa
//get another node //get another node
String url = urls.get(urls.size()); String url = urls.get(urls.size() - 1);
long startTime = System.nanoTime(); long startTime = System.nanoTime();
long maxTimeoutSeconds = 20; long maxTimeoutSeconds = 20;
@ -163,13 +165,13 @@ public class TestSolrConfigHandlerConcurrent extends AbstractFullDistribZkTestBa
Object o = getObjectByPath(m, true, asList("query", cacheName, "size")); Object o = getObjectByPath(m, true, asList("query", cacheName, "size"));
if(!val1.equals(o)) errmessages.add(StrUtils.formatString("'size' property not set, expected = {0}, actual {1}", val1, o)); if(!val1.equals(o.toString())) errmessages.add(StrUtils.formatString("'size' property not set, expected = {0}, actual {1}", val1, o));
o = getObjectByPath(m, true, asList("query", cacheName, "initialSize")); o = getObjectByPath(m, true, asList("query", cacheName, "initialSize"));
if(!val2.equals(o)) errmessages.add(StrUtils.formatString("'initialSize' property not set, expected = {0}, actual {1}", val2, o)); if(!val2.equals(o.toString())) errmessages.add(StrUtils.formatString("'initialSize' property not set, expected = {0}, actual {1}", val2, o));
o = getObjectByPath(m, true, asList("query", cacheName, "autowarmCount")); o = getObjectByPath(m, true, asList("query", cacheName, "autowarmCount"));
if(!val3.equals(o)) errmessages.add(StrUtils.formatString("'autowarmCount' property not set, expected = {0}, actual {1}", val3, o)); if(!val3.equals(o.toString())) errmessages.add(StrUtils.formatString("'autowarmCount' property not set, expected = {0}, actual {1}", val3, o));
if(errmessages.isEmpty()) break; if(errmessages.isEmpty()) break;
} }
if(!errmessages.isEmpty()) { if(!errmessages.isEmpty()) {