Apache Lucene open-source search software
Fixes for SOLR-3846 (very long tests on OS X for TestReplicationHandler)
Erick Erickson580b53efdd6a
diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorEndToEnd.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorEndToEnd.javaindex 36cb3f690a4..6a7108ec28e 100644--- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorEndToEnd.java+++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorEndToEnd.java@@ -47,7 +47,7 @@ public class TestSolrEntityProcessorEndToEnd extends AbstractDataImportHandlerTeprivate static Logger LOG = LoggerFactory.getLogger(TestSolrEntityProcessorEndToEnd.class);- //rivate static final String SOLR_SOURCE_URL = "http://localhost:8983/solr";+ //rivate static final String SOLR_SOURCE_URL = "http://127.0.0.1:8983/solr";private static final String SOLR_CONFIG = "dataimport-solrconfig.xml";private static final String SOLR_SCHEMA = "dataimport-schema.xml";private static final String SOLR_HOME = "dih/solr";@@ -95,7 +95,7 @@ public class TestSolrEntityProcessorEndToEnd extends AbstractDataImportHandlerTe}private static String getSourceUrl(int port) {- return "http://localhost:" + port + "/solr";+ return "http://127.0.0.1:" + port + "/solr";}//TODO: fix this test to close its directoriesdiff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-repeater.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-repeater.xmlindex 14d540c91f5..088728eb58c 100644--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-repeater.xml+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-repeater.xml@@ -55,7 +55,7 @@<str name="confFiles">schema.xml</str></lst><lst name="slave">- <str name="masterUrl">http://localhost:TEST_PORT/solr/replication</str>+ <str name="masterUrl">http://127.0.0.1:TEST_PORT/solr/replication</str><str name="pollInterval">00:00:01</str></lst></requestHandler>diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-slave.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-slave.xmlindex 0ff8f87680d..82b8636ef1d 100644--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-slave.xml+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-slave.xml@@ -51,7 +51,7 @@<requestHandler name="/replication" class="solr.ReplicationHandler"><lst name="slave">- <str name="masterUrl">http://localhost:TEST_PORT/solr</str>+ <str name="masterUrl">http://127.0.0.1:TEST_PORT/solr</str><str name="pollInterval">00:00:01</str><str name="compression">COMPRESSION</str></lst>diff --git a/solr/core/src/test/org/apache/solr/AnalysisAfterCoreReloadTest.java b/solr/core/src/test/org/apache/solr/AnalysisAfterCoreReloadTest.javaindex 9ba69183424..4262dccc6a8 100644--- a/solr/core/src/test/org/apache/solr/AnalysisAfterCoreReloadTest.java+++ b/solr/core/src/test/org/apache/solr/AnalysisAfterCoreReloadTest.java@@ -149,7 +149,7 @@ public class AnalysisAfterCoreReloadTest extends AbstractSolrTestCase {private SolrServer createServer( String name ) {try {// setup the server...- String url = "http://localhost:"+port+context+"/"+name;+ String url = "http://127.0.0.1:"+port+context+"/"+name;HttpSolrServer s = new HttpSolrServer( url );s.setConnectionTimeout(SolrTestCaseJ4.DEFAULT_CONNECTION_TIMEOUT);s.setDefaultMaxConnectionsPerHost(100);@@ -171,4 +171,4 @@ public class AnalysisAfterCoreReloadTest extends AbstractSolrTestCase {return "solrconfig.xml";}-}\ No newline at end of file+}diff --git a/solr/core/src/test/org/apache/solr/TestSolrCoreProperties.java b/solr/core/src/test/org/apache/solr/TestSolrCoreProperties.javaindex 6a27a09a5fb..9662e3d7cf1 100644--- a/solr/core/src/test/org/apache/solr/TestSolrCoreProperties.java+++ b/solr/core/src/test/org/apache/solr/TestSolrCoreProperties.java@@ -50,7 +50,7 @@ public class TestSolrCoreProperties extends LuceneTestCase {solrJetty = new JettySolrRunner(getHomeDir(), "/solr", 0);solrJetty.start();- String url = "http://localhost:" + solrJetty.getLocalPort() + "/solr";+ String url = "http://127.0.0.1:" + solrJetty.getLocalPort() + "/solr";client = new HttpSolrServer(url);}diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.javaindex b8c342e66bb..1df858caafc 100644--- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java+++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java@@ -132,7 +132,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {private static SolrServer createNewSolrServer(int port) {try {// setup the server...- String url = "http://localhost:" + port + context;+ String url = "http://127.0.0.1:" + port + context;HttpSolrServer s = new HttpSolrServer(url);s.setDefaultMaxConnectionsPerHost(100);s.setMaxTotalConnections(100);@@ -316,7 +316,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {index(masterClient, "id", i, "name", "name = " + i);}- String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=disableReplication";+ String masterUrl = "http://127.0.0.1:" + masterJetty.getLocalPort() + "/solr/replication?command=disableReplication";URL url = new URL(masterUrl);InputStream stream = url.openStream();try {@@ -353,7 +353,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");assertEquals(1, slaveQueryResult.getNumFound());- masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=enableReplication";+ masterUrl = "http://127.0.0.1:" + masterJetty.getLocalPort() + "/solr/replication?command=enableReplication";url = new URL(masterUrl);stream = url.openStream();try {@@ -468,7 +468,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {assertEquals(null, cmp);// start stop polling test- String slaveURL = "http://localhost:" + slaveJetty.getLocalPort() + "/solr/replication?command=disablepoll";+ String slaveURL = "http://127.0.0.1:" + slaveJetty.getLocalPort() + "/solr/replication?command=disablepoll";URL url = new URL(slaveURL);InputStream stream = url.openStream();try {@@ -494,7 +494,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {assertEquals(nDocs, slaveQueryResult.getNumFound());// re-enable replication- slaveURL = "http://localhost:" + slaveJetty.getLocalPort() + "/solr/replication?command=enablepoll";+ slaveURL = "http://127.0.0.1:" + slaveJetty.getLocalPort() + "/solr/replication?command=enablepoll";url = new URL(slaveURL);stream = url.openStream();try {@@ -529,8 +529,8 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {assertEquals(nDocs, masterQueryResult.getNumFound());// snappull- String masterUrl = "http://localhost:" + slaveJetty.getLocalPort() + "/solr/replication?command=fetchindex&masterUrl=";- masterUrl += "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication";+ String masterUrl = "http://127.0.0.1:" + slaveJetty.getLocalPort() + "/solr/replication?command=fetchindex&masterUrl=";+ masterUrl += "http://127.0.0.1:" + masterJetty.getLocalPort() + "/solr/replication";URL url = new URL(masterUrl);InputStream stream = url.openStream();try {@@ -555,8 +555,8 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {slaveClient.commit();- masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=fetchindex&masterUrl=";- masterUrl += "http://localhost:" + slaveJetty.getLocalPort() + "/solr/replication";+ masterUrl = "http://127.0.0.1:" + masterJetty.getLocalPort() + "/solr/replication?command=fetchindex&masterUrl=";+ masterUrl += "http://127.0.0.1:" + slaveJetty.getLocalPort() + "/solr/replication";url = new URL(masterUrl);stream = url.openStream();try {@@ -820,7 +820,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {@Overridepublic void run() {String masterUrl =- "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_BACKUP ++ "http://127.0.0.1:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_BACKUP +(addNumberToKeepInRequest ? "&" + backupKeepParamName + "=1" : "");URL url;InputStream stream = null;@@ -850,7 +850,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {}@Overridepublic void run() {- String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_DETAILS;+ String masterUrl = "http://127.0.0.1:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_DETAILS;URL url;InputStream stream = null;try {diff --git a/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java b/solr/core/src/test/org/apache/solr/schema/TestBinaryField.javaindex 3b27f1d4412..1d8a2019042 100644--- a/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java+++ b/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java@@ -81,7 +81,7 @@ public class TestBinaryField extends LuceneTestCase {jetty.start();port = jetty.getLocalPort();- String url = "http://localhost:" + jetty.getLocalPort() + context;+ String url = "http://127.0.0.1:" + jetty.getLocalPort() + context;server = new HttpSolrServer(url);}diff --git a/solr/core/src/test/org/apache/solr/search/TestSolrJ.java b/solr/core/src/test/org/apache/solr/search/TestSolrJ.javaindex aca3936e48a..ae280cfbb3a 100644--- a/solr/core/src/test/org/apache/solr/search/TestSolrJ.java+++ b/solr/core/src/test/org/apache/solr/search/TestSolrJ.java@@ -48,7 +48,7 @@ public class TestSolrJ extends SolrTestCaseJ4 {public static void main(String[] args) throws Exception {// String addr = "http://odin.local:80/solr";// String addr = "http://odin.local:8983/solr";- String addr = "http://localhost:8983/solr";+ String addr = "http://127.0.0.1:8983/solr";int i = 0;final int nDocs = Integer.parseInt(args[i++]);@@ -162,7 +162,7 @@ public class TestSolrJ extends SolrTestCaseJ4 {public void doCommitPerf() throws Exception {- HttpSolrServer client = new HttpSolrServer("http://localhost:8983/solr");+ HttpSolrServer client = new HttpSolrServer("http://127.0.0.1:8983/solr");long start = System.currentTimeMillis();diff --git a/solr/example/example-DIH/solr/solr/conf/solr-data-config.xml b/solr/example/example-DIH/solr/solr/conf/solr-data-config.xmlindex 49873f55eb7..48cf06e8ee5 100644--- a/solr/example/example-DIH/solr/solr/conf/solr-data-config.xml+++ b/solr/example/example-DIH/solr/solr/conf/solr-data-config.xml@@ -17,6 +17,6 @@<dataConfig><document>- <entity name="sep" processor="SolrEntityProcessor" url="http://localhost:8983/solr/db " query="*:*"/>+ <entity name="sep" processor="SolrEntityProcessor" url="http://127.0.0.1:8983/solr/db " query="*:*"/></document></dataConfig>diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.javaindex 1c90075815d..4333b92e721 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java@@ -41,7 +41,7 @@ public class SolrExampleBinaryTest extends SolrExampleTests {{try {// setup the server...- String url = "http://localhost:"+port+context;+ String url = "http://127.0.0.1:"+port+context;HttpSolrServer s = new HttpSolrServer( url );s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);s.setDefaultMaxConnectionsPerHost(100);diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleXMLTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleXMLTest.javaindex fca9c699ebe..1f9f8482b12 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleXMLTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleXMLTest.java@@ -36,7 +36,7 @@ public class SolrExampleXMLTest extends SolrExampleTests {@Overridepublic SolrServer createNewSolrServer() {try {- String url = "http://localhost:" + port + context;+ String url = "http://127.0.0.1:" + port + context;HttpSolrServer s = new HttpSolrServer(url);s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);s.setDefaultMaxConnectionsPerHost(100);diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.javaindex bfd5a724234..443085ae390 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java@@ -241,7 +241,7 @@ public class TestLBHttpSolrServer extends LuceneTestCase {}public String getUrl() {- return "http://localhost:" + port + "/solr";+ return "http://127.0.0.1:" + port + "/solr";}public String getSchemaFile() {diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.javaindex 9523bdcb5e2..bb1d93baa7d 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java@@ -92,7 +92,7 @@ public class JettyWebappTest extends LuceneTestCase// Currently not an extensive test, but it does fire up the JSP pages and make// sure they compile ok- String adminPath = "http://localhost:"+port+context+"/";+ String adminPath = "http://127.0.0.1:"+port+context+"/";byte[] bytes = IOUtils.toByteArray( new URL(adminPath).openStream() );assertNotNull( bytes ); // real error will be an exception}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.javaindex 941f3f674ad..9fe4743f208 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.java@@ -94,7 +94,7 @@ public class MultiCoreExampleJettyTest extends MultiCoreExampleTestBase {{try {// setup the server...- String url = "http://localhost:"+port+context+"/"+name;+ String url = "http://127.0.0.1:"+port+context+"/"+name;HttpSolrServer s = new HttpSolrServer( url );s.setConnectionTimeout(SolrTestCaseJ4.DEFAULT_CONNECTION_TIMEOUT);s.setDefaultMaxConnectionsPerHost(100);@@ -139,7 +139,7 @@ public class MultiCoreExampleJettyTest extends MultiCoreExampleTestBase {assertEquals( 1, r.process( getSolrCore1() ).getResults().size() );// Distributed- String baseURL = "localhost:"+port+context+"/";+ String baseURL = "127.0.0.1:"+port+context+"/";q = new SolrQuery( "*:*" );q.set( ShardParams.SHARDS, baseURL+"core0,"+baseURL+"core1" );q.set( "fl", "id,s:[shard]" );diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.javaindex bf131210778..94e23d06e01 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java@@ -42,7 +42,7 @@ public class SolrExampleJettyTest extends SolrExampleTests {{try {// setup the server...- String url = "http://localhost/?core=xxx";+ String url = "http://127.0.0.1/?core=xxx";HttpSolrServer s = new HttpSolrServer( url );Assert.fail( "CommonsHttpSolrServer should not allow a path with a parameter: "+s.getBaseURL() );}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.javaindex 7999bd73354..ceceac49e41 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java@@ -44,7 +44,7 @@ public class SolrExampleStreamingTest extends SolrExampleTests {{try {// setup the server...- String url = "http://localhost:"+port+context; // smaller queue size hits locks more often+ String url = "http://127.0.0.1:"+port+context; // smaller queue size hits locks more oftenConcurrentUpdateSolrServer s = new ConcurrentUpdateSolrServer( url, 2, 5 ) {public Throwable lastError = null;diff --git a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.javaindex 198bc20e5f7..d5f8c377be7 100644--- a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java+++ b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java@@ -86,8 +86,8 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {protected String shards;protected String[] shardsArr;// Some ISPs redirect to their own web site for domains that don't exist, causing this to fail- // protected String[] deadServers = {"does_not_exist_54321.com:33331/solr","localhost:33332/solr"};- protected String[] deadServers = {"[::1]:33332/solr"};+ // protected String[] deadServers = {"does_not_exist_54321.com:33331/solr","127.0.0.1:33332/solr"};+ protected String[] deadServers = {"[ff01::114]:33332/solr", "[ff01::083]:33332/solr", "[ff01::213]:33332/solr"};protected File testDir;protected SolrServer controlClient;@@ -267,7 +267,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {protected SolrServer createNewSolrServer(int port) {try {// setup the server...- String url = "http://localhost:" + port + context;+ String url = "http://127.0.0.1:" + port + context;HttpSolrServer s = new HttpSolrServer(url);s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);s.setDefaultMaxConnectionsPerHost(100);diff --git a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.javaindex 95e373bf9b4..9bd9ecb4ef6 100755--- a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java+++ b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java@@ -86,7 +86,7 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4if (jetty != null) {try {// setup the server...- String url = "http://localhost:"+port+context;+ String url = "http://127.0.0.1:"+port+context;HttpSolrServer s = new HttpSolrServer( url );s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);s.setDefaultMaxConnectionsPerHost(100);diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.javaindex 1d2eb31d8d8..751f3ee0390 100644--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java@@ -91,7 +91,7 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTesJettySolrRunner j = createJetty(jettyHome, null, "shard" + (i + 2));jettys.add(j);clients.add(createNewSolrServer(j.getLocalPort()));- sb.append("localhost:").append(j.getLocalPort()).append(context);+ sb.append("127.0.0.1:").append(j.getLocalPort()).append(context);}shards = sb.toString();diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.javaindex e756347b874..6191349bfb9 100644--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java@@ -334,8 +334,8 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTesJettySolrRunner j = this.jettys.get(i);JettySolrRunner j2 = this.jettys.get(i + (numJettys / 2 - 1));if (sb.length() > 0) sb.append(',');- sb.append("localhost:").append(j.getLocalPort()).append(context);- sb.append("|localhost:").append(j2.getLocalPort()).append(context);+ sb.append("127.0.0.1:").append(j.getLocalPort()).append(context);+ sb.append("|127.0.0.1:").append(j2.getLocalPort()).append(context);}shards = sb.toString();@@ -1198,7 +1198,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTesprotected SolrServer createNewSolrServer(int port) {try {// setup the server...- String url = "http://localhost:" + port + context + "/"+ String url = "http://127.0.0.1:" + port + context + "/"+ DEFAULT_COLLECTION;HttpSolrServer s = new HttpSolrServer(url);s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);