From ee7ebede5df20a4d59f2f4b2e8b18ba79d34b350 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sun, 28 Dec 2025 15:09:55 -0500 Subject: [PATCH 01/11] We copy extra solr.xml around that aren't needed to be copied --- .../test/org/apache/solr/SolrTestCaseJ4Test.java | 2 -- .../org/apache/solr/handler/V2StandaloneTest.java | 2 -- .../apache/solr/response/TestRawTransformer.java | 2 -- .../solr/client/solrj/TestLBHttpSolrClient.java | 14 -------------- .../solr/client/solrj/impl/LB2SolrClientTest.java | 14 -------------- .../src/java/org/apache/solr/SolrTestCaseJ4.java | 7 ------- 6 files changed, 41 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/SolrTestCaseJ4Test.java b/solr/core/src/test/org/apache/solr/SolrTestCaseJ4Test.java index f565649adf7..e7213bc3de5 100644 --- a/solr/core/src/test/org/apache/solr/SolrTestCaseJ4Test.java +++ b/solr/core/src/test/org/apache/solr/SolrTestCaseJ4Test.java @@ -47,8 +47,6 @@ public static void beforeClass() throws Exception { PathUtils.touch(tmpSolrHome.resolve("core0/core.properties")); PathUtils.touch(tmpSolrHome.resolve("core1/core.properties")); - Files.copy(getFile("solr/solr.xml"), tmpSolrHome.resolve("solr.xml")); - initCore("solrconfig-minimal.xml", "schema-tiny.xml", tmpSolrHome, "core1"); } diff --git a/solr/core/src/test/org/apache/solr/handler/V2StandaloneTest.java b/solr/core/src/test/org/apache/solr/handler/V2StandaloneTest.java index 43163e10218..aa76092cf5d 100644 --- a/solr/core/src/test/org/apache/solr/handler/V2StandaloneTest.java +++ b/solr/core/src/test/org/apache/solr/handler/V2StandaloneTest.java @@ -17,7 +17,6 @@ package org.apache.solr.handler; -import java.nio.file.Files; import java.nio.file.Path; import org.apache.commons.io.file.PathUtils; import org.apache.solr.SolrTestCaseJ4; @@ -35,7 +34,6 @@ public void testWelcomeMessage() throws Exception { Path solrHomeTmp = createTempDir(); PathUtils.copyDirectory( TEST_HOME().resolve("configsets/minimal/conf"), solrHomeTmp.resolve("conf")); - Files.copy(TEST_HOME().resolve("solr.xml"), solrHomeTmp.resolve("solr.xml")); JettySolrRunner jetty = new JettySolrRunner(solrHomeTmp.toString(), JettyConfig.builder().build()); diff --git a/solr/core/src/test/org/apache/solr/response/TestRawTransformer.java b/solr/core/src/test/org/apache/solr/response/TestRawTransformer.java index f806032b7b4..dd7335985ef 100644 --- a/solr/core/src/test/org/apache/solr/response/TestRawTransformer.java +++ b/solr/core/src/test/org/apache/solr/response/TestRawTransformer.java @@ -23,7 +23,6 @@ import java.util.Map; import java.util.Properties; import java.util.regex.Pattern; -import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer; import org.apache.solr.client.solrj.impl.CloudSolrClient; @@ -80,7 +79,6 @@ private static void initStandalone() throws Exception { final Path collDir = homeDir.resolve("collection1"); final Path confDir = collDir.resolve("conf"); Files.createDirectories(confDir); - Files.copy(SolrTestCaseJ4.TEST_HOME().resolve("solr.xml"), homeDir.resolve("solr.xml")); String src_dir = TEST_HOME() + "/collection1/conf"; Files.copy(Path.of(src_dir, "schema_latest.xml"), confDir.resolve("schema.xml")); Files.copy(Path.of(src_dir, "solrconfig-minimal.xml"), confDir.resolve("solrconfig.xml")); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java index 2ad79dc68c0..222a17018a6 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java @@ -278,10 +278,6 @@ public String getHomeDir() { return homeDir.toString(); } - public String getUrl() { - return buildUrl(port) + "/collection1"; - } - public String getBaseUrl() { return buildUrl(port); } @@ -294,10 +290,6 @@ public String getSchemaFile() { return "solrj/solr/collection1/conf/schema-replication1.xml"; } - public String getConfDir() { - return confDir.toString(); - } - public String getDataDir() { return dataDir.toString(); } @@ -306,17 +298,11 @@ public String getSolrConfigFile() { return "solrj/solr/collection1/conf/solrconfig-follower1.xml"; } - public String getSolrXmlFile() { - return "solrj/solr/solr.xml"; - } - public void setUp() throws Exception { Files.createDirectories(homeDir); Files.createDirectories(dataDir); Files.createDirectories(confDir); - Files.copy(SolrTestCaseJ4.getFile(getSolrXmlFile()), homeDir.resolve("solr.xml")); - Path f = confDir.resolve("solrconfig.xml"); Files.copy(SolrTestCaseJ4.getFile(getSolrConfigFile()), f); f = confDir.resolve("schema.xml"); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LB2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LB2SolrClientTest.java index ee94a47afce..2196f69675e 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LB2SolrClientTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LB2SolrClientTest.java @@ -256,10 +256,6 @@ public String getHomeDir() { return homeDir.toString(); } - public String getUrl() { - return buildUrl(port) + "/collection1"; - } - public String getBaseUrl() { return buildUrl(port); } @@ -272,10 +268,6 @@ public String getSchemaFile() { return "solrj/solr/collection1/conf/schema-replication1.xml"; } - public String getConfDir() { - return confDir.toString(); - } - public String getDataDir() { return dataDir.toString(); } @@ -284,17 +276,11 @@ public String getSolrConfigFile() { return "solrj/solr/collection1/conf/solrconfig-follower1.xml"; } - public String getSolrXmlFile() { - return "solrj/solr/solr.xml"; - } - public void setUp() throws Exception { Files.createDirectories(homeDir); Files.createDirectories(dataDir); Files.createDirectories(confDir); - Files.copy(SolrTestCaseJ4.getFile(getSolrXmlFile()), homeDir.resolve("solr.xml")); - Path f = confDir.resolve("solrconfig.xml"); Files.copy(SolrTestCaseJ4.getFile(getSolrConfigFile()), f); f = confDir.resolve("schema.xml"); diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java index 2036a94ce61..4660911fa97 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java @@ -2259,13 +2259,6 @@ public static void copyMinConf(Path dstRoot, String propertiesContent, String so subHome.resolve("solrconfig.snippet.randomindexconfig.xml")); } - // Creates minimal full setup, including solr.xml - public static void copyMinFullSetup(Path dstRoot) throws IOException { - Files.createDirectories(dstRoot); - Files.copy(SolrTestCaseJ4.TEST_PATH().resolve("solr.xml"), dstRoot.resolve("solr.xml")); - copyMinConf(dstRoot); - } - // Just copies the file indicated to the tmp home directory naming it "solr.xml" public static void copyXmlToHome(Path dstRoot, String fromFile) throws IOException { Files.createDirectories(dstRoot); From 4079397dbea71c3f38425b1c07ca2a761ff3d842 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sun, 28 Dec 2025 15:24:59 -0500 Subject: [PATCH 02/11] various setup calls that are NOT needed --- .../security/BasicAuthStandaloneTest.java | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java index 466e3ffed78..93594d72cfd 100644 --- a/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java +++ b/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.lang.invoke.MethodHandles; -import java.nio.file.Files; import java.nio.file.Path; import java.util.Base64; import java.util.Collections; @@ -54,8 +53,6 @@ public class BasicAuthStandaloneTest extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Path ROOT_DIR = TEST_HOME(); - private static final Path CONF_DIR = - ROOT_DIR.resolve("configsets").resolve("configset-2").resolve("conf"); SecurityConfHandlerLocalForTesting securityConfHandler; SolrInstance instance = null; @@ -211,7 +208,6 @@ static class SolrInstance { String name; Integer port; Path homeDir; - Path confDir; Path dataDir; /** @@ -227,36 +223,13 @@ public Path getHomeDir() { return homeDir; } - public Path getSchemaFile() { - return CONF_DIR.resolve("schema.xml"); - } - public Path getDataDir() { return dataDir; } - public Path getSolrConfigFile() { - return CONF_DIR.resolve("solrconfig.xml"); - } - - public Path getSolrXmlFile() { - return ROOT_DIR.resolve("solr.xml"); - } - public void setUp() throws Exception { homeDir = createTempDir(name).toAbsolutePath(); dataDir = homeDir.resolve("collection1").resolve("data"); - confDir = homeDir.resolve("collection1").resolve("conf"); - - Files.createDirectories(homeDir); - Files.createDirectories(dataDir); - Files.createDirectories(confDir); - - Files.copy(getSolrXmlFile(), homeDir.resolve("solr.xml")); - Files.copy(getSolrConfigFile(), confDir.resolve("solrconfig.xml")); - Files.copy(getSchemaFile(), confDir.resolve("schema.xml")); - - Files.createFile(homeDir.resolve("collection1").resolve("core.properties")); } } } From 91d2f92a4b308aca21603c57b05c54ac24232a5d Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sun, 28 Dec 2025 15:25:07 -0500 Subject: [PATCH 03/11] Unused variables --- .../org/apache/solr/jersey/JerseyApplicationSharingTest.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/jersey/JerseyApplicationSharingTest.java b/solr/core/src/test/org/apache/solr/jersey/JerseyApplicationSharingTest.java index df21c0cef8b..6410623de92 100644 --- a/solr/core/src/test/org/apache/solr/jersey/JerseyApplicationSharingTest.java +++ b/solr/core/src/test/org/apache/solr/jersey/JerseyApplicationSharingTest.java @@ -33,9 +33,6 @@ */ public class JerseyApplicationSharingTest extends SolrCloudTestCase { - private static final String collection = "collection1"; - private static final String confDir = collection + "/conf"; - @BeforeClass public static void setupCluster() throws Exception { configureCluster(1) From e8b8bcaee5ffa58377e9bf0756f1410d15827146 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sun, 28 Dec 2025 16:26:09 -0500 Subject: [PATCH 04/11] Removing unused settings --- .../apache/solr/TestCustomCoreProperties.java | 18 +++++------------- .../handler/TestReplicationHandlerBackup.java | 7 ++----- .../apache/solr/handler/TestRestoreCore.java | 9 +++------ .../solr/response/TestRawTransformer.java | 4 +--- .../apache/solr/schema/TestBinaryField.java | 3 --- .../solr/security/BasicAuthStandaloneTest.java | 4 +--- 6 files changed, 12 insertions(+), 33 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/TestCustomCoreProperties.java b/solr/core/src/test/org/apache/solr/TestCustomCoreProperties.java index 4173d80d5ab..d5a89ed7b9c 100644 --- a/solr/core/src/test/org/apache/solr/TestCustomCoreProperties.java +++ b/solr/core/src/test/org/apache/solr/TestCustomCoreProperties.java @@ -49,13 +49,11 @@ public static void beforeClass() throws Exception { Files.createDirectories(confDir); - Files.copy(SolrTestCaseJ4.TEST_HOME().resolve("solr.xml"), homeDir.resolve("solr.xml")); - String src_dir = TEST_HOME() + "/collection1/conf"; - Files.copy(Path.of(src_dir, "schema-tiny.xml"), confDir.resolve("schema.xml")); + String srcDir = TEST_HOME() + "/collection1/conf"; + Files.copy(Path.of(srcDir, "schema-tiny.xml"), confDir.resolve("schema.xml")); + Files.copy(Path.of(srcDir, "solrconfig-coreproperties.xml"), confDir.resolve("solrconfig.xml")); Files.copy( - Path.of(src_dir, "solrconfig-coreproperties.xml"), confDir.resolve("solrconfig.xml")); - Files.copy( - Path.of(src_dir, "solrconfig.snippet.randomindexconfig.xml"), + Path.of(srcDir, "solrconfig.snippet.randomindexconfig.xml"), confDir.resolve("solrconfig.snippet.randomindexconfig.xml")); Properties p = new Properties(); @@ -73,13 +71,7 @@ public static void beforeClass() throws Exception { coreProperties.store(fos, null); } - Properties nodeProperties = new Properties(); - // this sets the property for jetty starting SolrDispatchFilter - if (System.getProperty("solr.data.dir") == null) { - nodeProperties.setProperty("solr.data.dir", createTempDir().toRealPath().toString()); - } - - solrClientTestRule.startSolr(homeDir, nodeProperties, JettyConfig.builder().build()); + solrClientTestRule.startSolr(homeDir, new Properties(), JettyConfig.builder().build()); } @Test diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java index f59aa9cdffd..255d2a48557 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java +++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java @@ -68,12 +68,9 @@ public class TestReplicationHandlerBackup extends SolrJettyTestBase { private static JettySolrRunner createAndStartJetty(ReplicationTestHelper.SolrInstance instance) throws Exception { - Files.copy( - SolrTestCaseJ4.TEST_HOME().resolve("solr.xml"), Path.of(instance.getHomeDir(), "solr.xml")); - Properties nodeProperties = new Properties(); - nodeProperties.setProperty("solr.data.dir", instance.getDataDir()); JettyConfig jettyConfig = JettyConfig.builder().setPort(0).build(); - JettySolrRunner jetty = new JettySolrRunner(instance.getHomeDir(), nodeProperties, jettyConfig); + JettySolrRunner jetty = + new JettySolrRunner(instance.getHomeDir(), new Properties(), jettyConfig); jetty.start(); return jetty; } diff --git a/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java b/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java index 6d00d5a69b5..c3d43f14660 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java +++ b/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java @@ -53,12 +53,9 @@ public class TestRestoreCore extends SolrJettyTestBase { private static JettySolrRunner createAndStartJetty(ReplicationTestHelper.SolrInstance instance) throws Exception { - Files.copy( - SolrTestCaseJ4.TEST_HOME().resolve("solr.xml"), Path.of(instance.getHomeDir(), "solr.xml")); - Properties nodeProperties = new Properties(); - nodeProperties.setProperty("solr.data.dir", instance.getDataDir()); JettyConfig jettyConfig = JettyConfig.builder().setPort(0).build(); - JettySolrRunner jetty = new JettySolrRunner(instance.getHomeDir(), nodeProperties, jettyConfig); + JettySolrRunner jetty = + new JettySolrRunner(instance.getHomeDir(), new Properties(), jettyConfig); jetty.start(); return jetty; } @@ -180,7 +177,7 @@ public void testSimpleRestore() throws Exception { } } - public void testBackupFailsMissingAllowPaths() throws Exception { + public void testBackupFailsMissingAllowPaths() { final String params = "&location=" + URLEncoder.encode(createTempDir().toString(), StandardCharsets.UTF_8); Throwable t = diff --git a/solr/core/src/test/org/apache/solr/response/TestRawTransformer.java b/solr/core/src/test/org/apache/solr/response/TestRawTransformer.java index dd7335985ef..ba58f58cc23 100644 --- a/solr/core/src/test/org/apache/solr/response/TestRawTransformer.java +++ b/solr/core/src/test/org/apache/solr/response/TestRawTransformer.java @@ -94,11 +94,9 @@ private static void initStandalone() throws Exception { Files.copy(Path.of(src_dir, file), confDir.resolve(file)); } Files.createFile(collDir.resolve("core.properties")); - Properties nodeProperties = new Properties(); - nodeProperties.setProperty("solr.data.dir", h.getCore().getDataDir()); JSR = new JettySolrRunner( - homeDir.toAbsolutePath().toString(), nodeProperties, JettyConfig.builder().build()); + homeDir.toAbsolutePath().toString(), new Properties(), JettyConfig.builder().build()); } private static void initCloud() throws Exception { diff --git a/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java b/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java index daeac88eb92..27a2287b9ca 100644 --- a/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java +++ b/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java @@ -25,7 +25,6 @@ import java.util.List; import java.util.Properties; import org.apache.solr.SolrJettyTestBase; -import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.beans.Field; @@ -52,8 +51,6 @@ public static void beforeTest() throws Exception { Files.createDirectories(dataDir); Files.createDirectories(confDir); - Files.copy(SolrTestCaseJ4.TEST_HOME().resolve("solr.xml"), homeDir.resolve("solr.xml")); - String src_dir = TEST_HOME() + "/collection1/conf"; Files.copy(Path.of(src_dir, "schema-binaryfield.xml"), confDir.resolve("schema.xml")); Files.copy(Path.of(src_dir, "solrconfig-basic.xml"), confDir.resolve("solrconfig.xml")); diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java index 93594d72cfd..468b8c687c7 100644 --- a/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java +++ b/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java @@ -195,11 +195,9 @@ public static void setBasicAuthHeader(AbstractHttpMessage httpMsg, String user, } static JettySolrRunner createAndStartJetty(SolrInstance instance) throws Exception { - Properties nodeProperties = new Properties(); - nodeProperties.setProperty("solr.data.dir", instance.getDataDir().toString()); JettySolrRunner jetty = new JettySolrRunner( - instance.getHomeDir().toString(), nodeProperties, JettyConfig.builder().build()); + instance.getHomeDir().toString(), new Properties(), JettyConfig.builder().build()); jetty.start(); return jetty; } From e10ce961d60ab83e10eb29ec7bfebd91210a7c68 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sun, 28 Dec 2025 16:44:58 -0500 Subject: [PATCH 05/11] Need to disable the allow.urls to make test pass. --- .../org/apache/solr/handler/ReplicationTestHelper.java | 10 ++-------- .../handler/TestReplicationHandlerDiskOverFlow.java | 3 +++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java b/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java index 0a25972f7ac..f8abd34ca93 100644 --- a/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java +++ b/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java @@ -27,7 +27,6 @@ import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.Properties; import java.util.concurrent.TimeUnit; @@ -62,14 +61,9 @@ public final class ReplicationTestHelper { + FileSystems.getDefault().getSeparator(); public static JettySolrRunner createAndStartJetty(SolrInstance instance) throws Exception { - Files.copy( - SolrTestCaseJ4.TEST_HOME().resolve("solr.xml"), - Path.of(instance.getHomeDir(), "solr.xml"), - StandardCopyOption.REPLACE_EXISTING); - Properties nodeProperties = new Properties(); - nodeProperties.setProperty("solr.data.dir", instance.getDataDir()); JettyConfig jettyConfig = JettyConfig.builder().setPort(0).build(); - JettySolrRunner jetty = new JettySolrRunner(instance.getHomeDir(), nodeProperties, jettyConfig); + JettySolrRunner jetty = + new JettySolrRunner(instance.getHomeDir(), new Properties(), jettyConfig); jetty.start(); return jetty; } diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerDiskOverFlow.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerDiskOverFlow.java index 055b8423f5a..9c0d8a3abbb 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerDiskOverFlow.java +++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerDiskOverFlow.java @@ -68,6 +68,8 @@ public void setUp() throws Exception { originalTestWait = IndexFetcher.testWait; super.setUp(); + // Disable URL allow-list checks for replication tests + System.setProperty("solr.security.allow.urls.enabled", "false"); System.setProperty("solr.directoryFactory", "solr.StandardDirectoryFactory"); String factory = random().nextInt(100) < 75 @@ -114,6 +116,7 @@ public void tearDown() throws Exception { followerClient = null; } System.clearProperty(TEST_URL_ALLOW_LIST); + System.clearProperty("solr.security.allow.urls.enabled"); IndexFetcher.usableDiskSpaceProvider = originalDiskSpaceprovider; IndexFetcher.testWait = originalTestWait; From 150995b77c28da3a08a742137dad57643566cc33 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Tue, 30 Dec 2025 13:51:40 -0500 Subject: [PATCH 06/11] Remove unused property --- .../test/org/apache/solr/security/BasicAuthStandaloneTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java index 468b8c687c7..6b290aac687 100644 --- a/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java +++ b/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java @@ -52,7 +52,6 @@ public class BasicAuthStandaloneTest extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final Path ROOT_DIR = TEST_HOME(); SecurityConfHandlerLocalForTesting securityConfHandler; SolrInstance instance = null; From 21b14ccb382b557e76c465b66ad4124d3357eca4 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Tue, 30 Dec 2025 13:52:13 -0500 Subject: [PATCH 07/11] Remove method that A) doesn't do anything and B) only used by one subclass! --- solr/core/src/test/org/apache/solr/core/TestLazyCores.java | 1 - .../src/java/org/apache/solr/SolrTestCaseJ4.java | 6 ------ 2 files changed, 7 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/core/TestLazyCores.java b/solr/core/src/test/org/apache/solr/core/TestLazyCores.java index 87e8c336920..661b27d912a 100644 --- a/solr/core/src/test/org/apache/solr/core/TestLazyCores.java +++ b/solr/core/src/test/org/apache/solr/core/TestLazyCores.java @@ -68,7 +68,6 @@ public List discover(CoreContainer cc) { private CoreContainer init() throws Exception { solrHomeDirectory = createTempDir(); - copyXmlToHome(solrHomeDirectory, "solr.xml"); for (int idx = 1; idx < 10; ++idx) { copyMinConf(solrHomeDirectory.resolve("collection" + idx)); } diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java index f253a149ce2..1bb1787adb3 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java @@ -2255,12 +2255,6 @@ public static void copyMinConf(Path dstRoot, String propertiesContent, String so subHome.resolve("solrconfig.snippet.randomindexconfig.xml")); } - // Just copies the file indicated to the tmp home directory naming it "solr.xml" - public static void copyXmlToHome(Path dstRoot, String fromFile) throws IOException { - Files.createDirectories(dstRoot); - Files.copy(SolrTestCaseJ4.TEST_PATH().resolve(fromFile), dstRoot.resolve("solr.xml")); - } - // Creates a consistent configuration, _including_ solr.xml at dstRoot. Creates collection1/conf // and copies the stock files in there. From 8330f9cddd91446630de2ec2c9e7249db916f2af Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Tue, 30 Dec 2025 17:00:30 -0500 Subject: [PATCH 08/11] Remove unneeded piece of test setup --- .../src/java/org/apache/solr/SolrTestCaseJ4.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java index 1bb1787adb3..0aefd607f5b 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java @@ -2298,8 +2298,7 @@ public static Path legacyExampleCollection1SolrHome() { try { Path tempSolrHome = FilterPath.unwrap(LuceneTestCase.createTempDir()); Path serverSolr = tempSolrHome.resolve(sourceHome).resolve("server").resolve("solr"); - Files.copy(serverSolr.resolve("solr.xml"), tempSolrHome.resolve("solr.xml")); - + Path sourceConfig = serverSolr.resolve("configsets").resolve("sample_techproducts_configs"); Path collection1Dir = tempSolrHome.resolve("collection1"); From f14e67f9c97f8d5b9d6222894b670a708e98e954 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Tue, 30 Dec 2025 17:12:01 -0500 Subject: [PATCH 09/11] lint --- solr/core/src/test/org/apache/solr/schema/TestBinaryField.java | 1 - .../test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java b/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java index f3f30529954..f04399460f0 100644 --- a/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java +++ b/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java @@ -19,7 +19,6 @@ import java.nio.ByteBuffer; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.StandardCopyOption; import java.util.List; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java index 0e4c70d538c..b63352c0bda 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java @@ -2301,7 +2301,7 @@ public static Path legacyExampleCollection1SolrHome() { try { Path tempSolrHome = FilterPath.unwrap(LuceneTestCase.createTempDir()); Path serverSolr = tempSolrHome.resolve(sourceHome).resolve("server").resolve("solr"); - + Path sourceConfig = serverSolr.resolve("configsets").resolve("sample_techproducts_configs"); Path collection1Dir = tempSolrHome.resolve("collection1"); From f8d6c93b695afa2dd7de291fd7909ab10b0c191e Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Tue, 30 Dec 2025 17:16:21 -0500 Subject: [PATCH 10/11] fix merge issue --- .../test/org/apache/solr/schema/TestBinaryField.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java b/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java index f04399460f0..0c830249ae0 100644 --- a/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java +++ b/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java @@ -19,6 +19,7 @@ import java.nio.ByteBuffer; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.StandardCopyOption; import java.util.List; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; @@ -45,9 +46,12 @@ public static void beforeTest() throws Exception { copyMinConf(collDir, "name=collection1\n", "solrconfig-basic.xml"); + // Copy the custom schema for binary field tests String sourceConfDir = TEST_HOME() + "/collection1/conf"; - Files.copy(Path.of(sourceConfDir, "schema-binaryfield.xml"), confDir.resolve("schema.xml")); - Files.copy(Path.of(sourceConfDir, "solrconfig-basic.xml"), confDir.resolve("solrconfig.xml")); + Files.copy( + Path.of(sourceConfDir, "schema-binaryfield.xml"), + collDir.resolve("conf/schema.xml"), + StandardCopyOption.REPLACE_EXISTING); solrTestRule.startSolr(homeDir); } @@ -85,7 +89,7 @@ public void testSimple() throws Exception { assertEquals(3, res.size()); assertEquals(3, beans.size()); for (SolrDocument d : res) { - Integer id = Integer.parseInt(d.getFieldValue("id").toString()); + int id = Integer.parseInt(d.getFieldValue("id").toString()); for (String field : new String[] {"data", "data_dv"}) { byte[] data = (byte[]) d.getFieldValue(field); if (id == 1) { @@ -112,7 +116,7 @@ public void testSimple() throws Exception { } } for (Bean d : beans) { - Integer id = Integer.parseInt(d.id); + int id = Integer.parseInt(d.id); for (byte[] data : new byte[][] {d.data, d.data_dv}) { if (id == 1) { assertEquals(5, data.length); From 56f2c8b4e40f2ac56e395c942aa21412ac4095f5 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sat, 3 Jan 2026 07:26:08 -0500 Subject: [PATCH 11/11] audited use of this command and removed for where core creation is sync process --- .../handler/component/DistributedDebugComponentTest.java | 2 -- .../apache/solr/response/TestPrometheusResponseWriter.java | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java index 75b4de3ffd4..5384f9e88e5 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java @@ -64,8 +64,6 @@ public static void createThings() throws Exception { .newCollection("collection2") .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET) .create(); - var cc = solrTestRule.getCoreContainer(); - cc.waitForLoadingCoresToFinish(30000); String urlCollection1 = solrTestRule.getBaseUrl() + "/" + "collection1"; String urlCollection2 = solrTestRule.getBaseUrl() + "/" + "collection2"; diff --git a/solr/core/src/test/org/apache/solr/response/TestPrometheusResponseWriter.java b/solr/core/src/test/org/apache/solr/response/TestPrometheusResponseWriter.java index 76738839a1a..b38706a0108 100644 --- a/solr/core/src/test/org/apache/solr/response/TestPrometheusResponseWriter.java +++ b/solr/core/src/test/org/apache/solr/response/TestPrometheusResponseWriter.java @@ -25,7 +25,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.stream.Collectors; import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.SolrClient; @@ -51,8 +50,6 @@ public static void beforeClass() throws Exception { solrTestRule.startSolr(LuceneTestCase.createTempDir()); solrTestRule.newCollection("core1").withConfigSet(ExternalPaths.DEFAULT_CONFIGSET).create(); solrTestRule.newCollection("core2").withConfigSet(ExternalPaths.DEFAULT_CONFIGSET).create(); - var cc = solrTestRule.getCoreContainer(); - cc.waitForLoadingCoresToFinish(30000); // Populate request metrics on both cores ModifiableSolrParams queryParams = new ModifiableSolrParams(); @@ -88,7 +85,7 @@ public void testPrometheusStructureOutput() throws Exception { seenTypeInfo.add(line)); return false; }) - .collect(Collectors.toList()); + .toList(); filteredResponse.forEach( (actualMetric) -> { String actualValue;