SOLR-9679: Harden BasicAuthOnSingleNodeTest#testDeleteSecurityJsonZnode

This commit is contained in:
Jan Høydahl 2020-06-08 10:46:53 +02:00
parent 7bf59a16bd
commit 3e538005ec
1 changed files with 15 additions and 1 deletions

View File

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