Apache Solr open-source search software
SOLR-17088: Fix custom solr.xml usage in tests with extra jettys (#2437)
Houston Putmanb63e9cfe0aa5
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.javaindex 0d901020cb5..5e0461f5240 100644--- a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java+++ b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java@@ -162,6 +162,7 @@ public class MiniSolrCloudCluster {private final Path baseDir;private CloudSolrClient solrClient;private final JettyConfig jettyConfig;+ private final String solrXml;private final boolean trackJettyMetrics;private final AtomicInteger nodeIds = new AtomicInteger();@@ -276,6 +277,7 @@ public class MiniSolrCloudCluster {Objects.requireNonNull(securityJson);this.baseDir = Objects.requireNonNull(baseDir);this.jettyConfig = Objects.requireNonNull(jettyConfig);+ this.solrXml = solrXml == null ? DEFAULT_CLOUD_SOLR_XML : solrXml;this.trackJettyMetrics = trackJettyMetrics;log.info("Starting cluster of {} servers in {}", numServers, baseDir);@@ -478,18 +480,18 @@ public class MiniSolrCloudCluster {** @param name the instance name* @param config a JettyConfig for the instance's {@link org.apache.solr.embedded.JettySolrRunner}- * @param solrXml the string content of the solr.xml file to use, or null to just use default+ * @param solrXml the string content of the solr.xml file to use, or null to just use the+ * cluster's default* @return a JettySolrRunner*/public JettySolrRunner startJettySolrRunner(String name, JettyConfig config, String solrXml)throws Exception {- // tell solr node to look in zookeeper for solr.xmlfinal Properties nodeProps = new Properties();nodeProps.setProperty("zkHost", zkServer.getZkAddress());Path runnerPath = createInstancePath(name);if (solrXml == null) {- solrXml = DEFAULT_CLOUD_SOLR_XML;+ solrXml = this.solrXml;}Files.write(runnerPath.resolve("solr.xml"), solrXml.getBytes(StandardCharsets.UTF_8));JettyConfig newConfig = JettyConfig.builder(config).build();