hack broken test to not waste hours of jenkins time

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1426096 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-12-27 00:48:57 +00:00
parent 6cd89df2c1
commit 53caac2cc4
1 changed files with 6 additions and 1 deletions

View File

@ -124,20 +124,25 @@ public class BasicHttpSolrServerTest extends SolrJettyTestBase {
.addServletWithMapping(DebugServlet.class, "/debug/*");
}
// what is this actually testing? this test WILL randomly fail.
// not a good unit test!
@Test
public void testConnectionRefused() throws MalformedURLException {
int unusedPort = findUnusedPort(); // XXX even if fwe found an unused port
// it might not be unused anymore
HttpSolrServer server = new HttpSolrServer("http://127.0.0.1:" + unusedPort
+ "/solr");
server.setConnectionTimeout(500);
SolrQuery q = new SolrQuery("*:*");
try {
QueryResponse response = server.query(q);
fail("Should have thrown an exception.");
} catch (SolrServerException e) {
assumeFalse("blackholed!", e.getMessage().contains("IOException occured when talking to server"));
assertTrue(e.getMessage().contains("refused"));
} finally {
server.shutdown();
}
server.shutdown();
}
@Test