SOLR-12791, SOLR-13067: Fix test failure for BasicAuthIntegrationTest

Make PkiAuthenticationIntegrationTest beast-able
This commit is contained in:
Jan Høydahl 2018-12-13 00:14:37 +01:00
parent 1e68726831
commit 9728dbc167
2 changed files with 9 additions and 7 deletions

View File

@ -254,7 +254,7 @@ public class BasicAuthIntegrationTest extends SolrCloudAuthTestCase {
});
assertEquals(401, exp.code());
assertAuthMetricsMinimums(20, 8, 9, 1, 2, 0);
assertPkiAuthMetricsMinimums(4, 4, 0, 0, 0, 0);
assertPkiAuthMetricsMinimums(3, 3, 0, 0, 0, 0);
// Query that succeeds
GenericSolrRequest req = new GenericSolrRequest(SolrRequest.METHOD.GET, "/select", params);
@ -262,7 +262,7 @@ public class BasicAuthIntegrationTest extends SolrCloudAuthTestCase {
cluster.getSolrClient().request(req, COLLECTION);
assertAuthMetricsMinimums(21, 9, 9, 1, 2, 0);
assertPkiAuthMetricsMinimums(7, 7, 0, 0, 0, 0);
assertPkiAuthMetricsMinimums(6, 6, 0, 0, 0, 0);
executeCommand(baseUrl + authcPrefix, cl, "{set-property : { blockUnknown: false}}", "harry", "HarryIsUberCool");
} finally {

View File

@ -42,19 +42,21 @@ import static org.apache.solr.security.TestAuthorizationFramework.verifySecurity
public class PKIAuthenticationIntegrationTest extends SolrCloudAuthTestCase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final String COLLECTION = "pkiCollection";
@BeforeClass
public static void setupCluster() throws Exception {
configureCluster(2)
.addConfig("conf", configset("cloud-minimal"))
.configure();
CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1).process(cluster.getSolrClient());
cluster.waitForActiveCollection(COLLECTION, 2, 2);
}
@Test
public void testPkiAuth() throws Exception {
CollectionAdminRequest.createCollection("collection", "conf", 2, 1).process(cluster.getSolrClient());
// TODO make a SolrJ helper class for this
byte[] bytes = Utils.toJSON(makeMap("authorization", singletonMap("class", MockAuthorizationPlugin.class.getName()),
"authentication", singletonMap("class", MockAuthenticationPlugin.class.getName())));
@ -94,7 +96,7 @@ public class PKIAuthenticationIntegrationTest extends SolrCloudAuthTestCase {
return true;
};
QueryRequest query = new QueryRequest(params);
query.process(cluster.getSolrClient(), "collection");
query.process(cluster.getSolrClient(), COLLECTION);
assertTrue("all nodes must get the user solr , no:of nodes got solr : " + count.get(), count.get() > 2);
assertPkiAuthMetricsMinimums(2, 2, 0, 0, 0, 0);
}