Skip to content

Commit 9f7ada8

Browse files
kiviewpayallenka
andauthored
Support Solr 10 in SolrContainer (#12169)
Solr 10 starts in cloud mode by default and 10.1 rejects an empty -DzkRun. On Solr 10 and later, standalone mode now adds --user-managed and SolrCloud mode uses -Dsolr.zookeeper.server.enabled=true. Adds solr:10.1.0 to the tested versions. Fixes #12147. Supersedes #12148. Co-authored-by: Payal Lenka <payalm.lenka@gmail.com>
1 parent e16dca9 commit 9f7ada8

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎modules/solr/src/main/java/org/testcontainers/solr/SolrContainer.java‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,20 @@ protected void configure() {
9696
}
9797
// Generate Command Builder
9898
String command = "solr start -f";
99+
// Solr 10 starts in cloud mode by default
100+
if (this.imageVersion.isGreaterThanOrEqualTo("10.0.0")) {
101+
command = "solr start -f --user-managed";
102+
}
99103
// Add Default Ports
100104
addExposedPort(SOLR_PORT);
101105

102106
// Configure Zookeeper
103107
if (configuration.isZookeeper()) {
104108
addExposedPort(ZOOKEEPER_PORT);
105-
if (this.imageVersion.isGreaterThanOrEqualTo("9.7.0")) {
109+
if (this.imageVersion.isGreaterThanOrEqualTo("10.0.0")) {
110+
// zkRun is deprecated and no longer accepted without a value since Solr 10.1
111+
command = "-Dsolr.zookeeper.server.enabled=true --host localhost";
112+
} else if (this.imageVersion.isGreaterThanOrEqualTo("9.7.0")) {
106113
command = "-DzkRun --host localhost";
107114
} else {
108115
command = "-DzkRun -h localhost";

‎modules/solr/src/test/java/org/testcontainers/solr/SolrContainerTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class SolrContainerTest {
1717
private SolrClient client = null;
1818

1919
public static String[] getVersionsToTest() {
20-
return new String[] { "solr:8.11.4", "solr:9.8.0" };
20+
return new String[] { "solr:8.11.4", "solr:9.8.0", "solr:10.1.0" };
2121
}
2222

2323
@AfterEach

0 commit comments

Comments
 (0)