mirror of https://github.com/apache/lucene.git
SOLR-8787: Shutdown MiniSolrCloudCluster in a finally block
This commit is contained in:
parent
6528dacb0e
commit
0a15699caa
|
@ -104,27 +104,28 @@ public class TestAuthenticationFramework extends LuceneTestCase {
|
||||||
public void testBasics() throws Exception {
|
public void testBasics() throws Exception {
|
||||||
|
|
||||||
MiniSolrCloudCluster miniCluster = createMiniSolrCloudCluster();
|
MiniSolrCloudCluster miniCluster = createMiniSolrCloudCluster();
|
||||||
|
|
||||||
// Should pass
|
|
||||||
collectionCreateSearchDelete(miniCluster);
|
|
||||||
|
|
||||||
MockAuthenticationPlugin.expectedUsername = "solr";
|
|
||||||
MockAuthenticationPlugin.expectedPassword = "s0lrRocks";
|
|
||||||
|
|
||||||
// Should fail with 401
|
|
||||||
try {
|
try {
|
||||||
|
// Should pass
|
||||||
collectionCreateSearchDelete(miniCluster);
|
collectionCreateSearchDelete(miniCluster);
|
||||||
fail("Should've returned a 401 error");
|
|
||||||
} catch (Exception ex) {
|
MockAuthenticationPlugin.expectedUsername = "solr";
|
||||||
if (!ex.getMessage().contains("Error 401")) {
|
MockAuthenticationPlugin.expectedPassword = "s0lrRocks";
|
||||||
|
|
||||||
|
// Should fail with 401
|
||||||
|
try {
|
||||||
|
collectionCreateSearchDelete(miniCluster);
|
||||||
fail("Should've returned a 401 error");
|
fail("Should've returned a 401 error");
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (!ex.getMessage().contains("Error 401")) {
|
||||||
|
fail("Should've returned a 401 error");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
MockAuthenticationPlugin.expectedUsername = null;
|
||||||
|
MockAuthenticationPlugin.expectedPassword = null;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
MockAuthenticationPlugin.expectedUsername = null;
|
miniCluster.shutdown();
|
||||||
MockAuthenticationPlugin.expectedPassword = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
miniCluster.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|
Loading…
Reference in New Issue