Skip to content

Commit b63e9cf

Browse files
SOLR-17088: Fix custom solr.xml usage in tests with extra jettys (#2437)
1 parent 2bb2ada commit b63e9cf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ public class MiniSolrCloudCluster {
162162
private final Path baseDir;
163163
private CloudSolrClient solrClient;
164164
private final JettyConfig jettyConfig;
165+
private final String solrXml;
165166
private final boolean trackJettyMetrics;
166167

167168
private final AtomicInteger nodeIds = new AtomicInteger();
@@ -276,6 +277,7 @@ public MiniSolrCloudCluster(
276277
Objects.requireNonNull(securityJson);
277278
this.baseDir = Objects.requireNonNull(baseDir);
278279
this.jettyConfig = Objects.requireNonNull(jettyConfig);
280+
this.solrXml = solrXml == null ? DEFAULT_CLOUD_SOLR_XML : solrXml;
279281
this.trackJettyMetrics = trackJettyMetrics;
280282

281283
log.info("Starting cluster of {} servers in {}", numServers, baseDir);
@@ -478,18 +480,18 @@ public JettySolrRunner getJettySolrRunner(int index) {
478480
*
479481
* @param name the instance name
480482
* @param config a JettyConfig for the instance's {@link org.apache.solr.embedded.JettySolrRunner}
481-
* @param solrXml the string content of the solr.xml file to use, or null to just use default
483+
* @param solrXml the string content of the solr.xml file to use, or null to just use the
484+
* cluster's default
482485
* @return a JettySolrRunner
483486
*/
484487
public JettySolrRunner startJettySolrRunner(String name, JettyConfig config, String solrXml)
485488
throws Exception {
486-
// tell solr node to look in zookeeper for solr.xml
487489
final Properties nodeProps = new Properties();
488490
nodeProps.setProperty("zkHost", zkServer.getZkAddress());
489491

490492
Path runnerPath = createInstancePath(name);
491493
if (solrXml == null) {
492-
solrXml = DEFAULT_CLOUD_SOLR_XML;
494+
solrXml = this.solrXml;
493495
}
494496
Files.write(runnerPath.resolve("solr.xml"), solrXml.getBytes(StandardCharsets.UTF_8));
495497
JettyConfig newConfig = JettyConfig.builder(config).build();

0 commit comments

Comments
 (0)