Along the way, I wondered "gee, what happens if we create a core in discovery mode?" Well, we don't preserve properties passed on the URL. This patch preserves any parameters passed in on the admin URL, e.g. dataDir, config etc.
Oddly, you have to specify instanceDir even though it isn't a valid property for core.properties, else how do we let the user specify something not immediately below <solrhome>?
But my remaining problem is that I can't exit the test gracefully, searchers are left hanging and we get the partial stack trace below.
This usually means we did a CoreContainer.get and no corresponding close, but there aren't any such things. I think I even closed loading properties this time, although that would be unrelated I think.
When we create cores in old-style solr.xml land, there's no need to do anything special to exit the tests. So I'm hoping someone has an "aha" moment. Otherwise I need to dig into core creation in the discovery case and find out if it really is different.
java.lang.AssertionError: ERROR: SolrIndexSearcher opens=3 closes=1
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)