Fixes for SOLR-3846 (very long tests on OS X for TestReplicationHandler)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1387099 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erick Erickson 2012-09-18 11:40:13 +00:00
parent fa9182cfb6
commit 580b53efdd
20 changed files with 38 additions and 38 deletions

View File

@ -47,7 +47,7 @@ public class TestSolrEntityProcessorEndToEnd extends AbstractDataImportHandlerTe
private 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 directories

View File

@ -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>

View File

@ -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>

View File

@ -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";
}
}
}

View File

@ -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);
}

View File

@ -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 {
@Override
public 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 {
}
@Override
public 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 {

View File

@ -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);
}

View File

@ -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();

View File

@ -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>

View File

@ -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);

View File

@ -36,7 +36,7 @@ public class SolrExampleXMLTest extends SolrExampleTests {
@Override
public 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);

View File

@ -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() {

View File

@ -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
}

View File

@ -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]" );

View File

@ -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() );
}

View File

@ -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 often
ConcurrentUpdateSolrServer s = new ConcurrentUpdateSolrServer( url, 2, 5 ) {
public Throwable lastError = null;

View File

@ -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);

View File

@ -86,7 +86,7 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4
if (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);

View File

@ -91,7 +91,7 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes
JettySolrRunner 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();

View File

@ -334,8 +334,8 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
JettySolrRunner 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 AbstractDistribZkTes
protected 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);