I wrote a test in Solr extending SolrTestCaseJ4 that sets up Solr a bit
differently than some tests. Essentially instead of writing yet another
test schema.xml file, I decided to use some stock configs that are already
in a managed-schema mode that allow me to manipulate the schema via test
code -- but not persist it since I don't want/need that. I could share the
code if it helps. Any way, my test passes when run via IntelliJ; the test
JVM ends normally.
But when I run via "ant test-core -Dtestcase=mytestclassname" the test
itself passes but the build fails. Right before the "5 slowest tests"
printout is the following curious message:
Could not remove temporary path:
/SmileyDev/Search/lucene-solr_6x/solr/build/solr-core/test/J0
(/SmileyDev/Search/lucene-solr_6x/solr/build/solr-core/test/J0)
I can't find the string "Could not remove temporary path" in our codebase;
maybe it's in randomized-testing? (CC Dawid) I'm not sure how to debug
this... maybe Solr wasn't closed properly? Although this doesn't happen
when run via IntelliJ; maybe there's a race.
Here's my @BeforeClass:
@BeforeClass
private static void initManagedSchemaCore() throws Exception {
// This testing approach means no new solrconfig or schema file or
per-test temp solr-home!
System.setProperty("managed.schema.mutable", "true");
System.setProperty("managed.schema.resourceName",
"schema-one-field-no-dynamic-field-unique-key.xml");
System.setProperty("enable.update.log", "false");
initCore("solrconfig-managed-schema.xml", "ignoredSchemaName?");
IndexSchema oldSchema = h.getCore().getLatestSchema();
HeatmapSpatialField fieldType = new HeatmapSpatialField();
Map<String, String> ftInitMap = new HashMap<>();
ftInitMap.put("prefixTree", "packedQuad");
ftInitMap.put("square", "true");
ftInitMap.put("minDistErr", "1000");
ftInitMap.put("maxDistErr", "50");
ftInitMap.put("distanceUnits", "kilometers");
fieldType.init(oldSchema, ftInitMap);
fieldType.setTypeName("heatmapType");
SchemaField schemaField = new SchemaField(HM_FLD, fieldType,
SchemaField.STORED | SchemaField.INDEXED, null);
boolean persist = false; // don't write to test resource dir
IndexSchema newSchema = oldSchema.addField(schemaField, persist);
h.getCore().setLatestSchema(newSchema);
strategy = fieldType.getStrategy(schemaField.getName());
ctx = strategy.getSpatialContext();
}
Or maybe most of that info is a red herring and the problem is something
else. Any way, it'd be nice if someone else who ran into this problem
before could share some advice.
Thanks in advance,
~ David
--
Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker
LinkedIn: http://linkedin.com/in/davidwsmiley | Book:
http://www.solrenterprisesearchserver.com