You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2016/06/30 17:02:30 UTC

lucene-solr:branch_6x: SOLR-8787: Shutdown MiniSolrCloudCluster in a finally block (cherry picked from commit 0a15699)

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x c7d82e7b3 -> 18434526d


SOLR-8787: Shutdown MiniSolrCloudCluster in a finally block
(cherry picked from commit 0a15699)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/18434526
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/18434526
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/18434526

Branch: refs/heads/branch_6x
Commit: 18434526d6ef73373796481ef3ccd637694e3dfe
Parents: c7d82e7
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Thu Jun 30 22:32:23 2016 +0530
Committer: Shalin Shekhar Mangar <sh...@apache.org>
Committed: Thu Jun 30 22:32:47 2016 +0530

----------------------------------------------------------------------
 .../solr/cloud/TestAuthenticationFramework.java | 31 ++++++++++----------
 1 file changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/18434526/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
index 339ad75..22d7e04 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
@@ -106,27 +106,28 @@ public class TestAuthenticationFramework extends LuceneTestCase {
   public void testBasics() throws Exception {
 
     MiniSolrCloudCluster miniCluster = createMiniSolrCloudCluster();
-
-    // Should pass
-    collectionCreateSearchDelete(miniCluster);
-
-    MockAuthenticationPlugin.expectedUsername = "solr";
-    MockAuthenticationPlugin.expectedPassword = "s0lrRocks";
-    
-    // Should fail with 401
     try {
+      // Should pass
       collectionCreateSearchDelete(miniCluster);
-      fail("Should've returned a 401 error");
-    } catch (Exception ex) {
-      if (!ex.getMessage().contains("Error 401")) {
+
+      MockAuthenticationPlugin.expectedUsername = "solr";
+      MockAuthenticationPlugin.expectedPassword = "s0lrRocks";
+
+      // Should fail with 401
+      try {
+        collectionCreateSearchDelete(miniCluster);
         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 {
-      MockAuthenticationPlugin.expectedUsername = null;
-      MockAuthenticationPlugin.expectedPassword = null;
+      miniCluster.shutdown();
     }
-
-    miniCluster.shutdown();
   }
 
   @After