You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2020/06/08 08:47:33 UTC

[lucene-solr] branch master updated: SOLR-9679: Harden BasicAuthOnSingleNodeTest#testDeleteSecurityJsonZnode

This is an automated email from the ASF dual-hosted git repository.

janhoy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e53800  SOLR-9679: Harden BasicAuthOnSingleNodeTest#testDeleteSecurityJsonZnode
3e53800 is described below

commit 3e538005ecb4dd20fb05c6da4e20a20e846a2a3f
Author: Jan Høydahl <ja...@apache.org>
AuthorDate: Mon Jun 8 10:46:53 2020 +0200

    SOLR-9679: Harden BasicAuthOnSingleNodeTest#testDeleteSecurityJsonZnode
---
 .../apache/solr/security/BasicAuthOnSingleNodeTest.java  | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java
index a904009..766e092 100644
--- a/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java
+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java
@@ -80,7 +80,21 @@ public class BasicAuthOnSingleNodeTest extends SolrCloudAuthTestCase {
       // Deleting security.json will disable security - before SOLR-9679 it would instead cause an exception
       cluster.getZkClient().delete("/security.json", -1, false);
 
-      assertNotNull(new QueryRequest(params("q", "*:*")).process(client, COLLECTION));
+      int count = 0;
+      boolean done = false;
+      // Assert that security is turned off. This is async, so we retry up to 5s before failing the test
+      while (!done) {
+        try {
+          Thread.sleep(500);
+          count += 1;
+          new QueryRequest(params("q", "*:*")).process(client, COLLECTION);
+          done = true;
+        } catch (Exception e) {
+          if (count >= 10) {
+            fail("Failed 10 times to query without credentials after removing security.json");
+          }
+        }
+      }
     }
   }