SOLR-11243: Fix for the AutoScalingHandlerTest.testReadApi

This commit is contained in:
Shalin Shekhar Mangar 2017-08-16 13:09:20 +05:30
parent ae43ffe354
commit 8d8c629425
1 changed files with 12 additions and 0 deletions

View File

@ -284,12 +284,24 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
assertNotNull(violations); assertNotNull(violations);
assertEquals(0, violations.size()); assertEquals(0, violations.size());
String setEmptyClusterPolicyCommand = "{" +
" 'set-cluster-policy': []" +
"}";
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setEmptyClusterPolicyCommand);
response = solrClient.request(req);
assertEquals(response.get("result").toString(), "success");
// lets create a collection which violates the rule replicas < 2 // lets create a collection which violates the rule replicas < 2
CollectionAdminRequest.Create create = CollectionAdminRequest.Create.createCollection("readApiTestViolations", CONFIGSET_NAME, 1, 6); CollectionAdminRequest.Create create = CollectionAdminRequest.Create.createCollection("readApiTestViolations", CONFIGSET_NAME, 1, 6);
create.setMaxShardsPerNode(10); create.setMaxShardsPerNode(10);
CollectionAdminResponse adminResponse = create.process(solrClient); CollectionAdminResponse adminResponse = create.process(solrClient);
assertTrue(adminResponse.isSuccess()); assertTrue(adminResponse.isSuccess());
// reset the original cluster policy
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
response = solrClient.request(req);
assertEquals(response.get("result").toString(), "success");
// get the diagnostics output again // get the diagnostics output again
req = createAutoScalingRequest(SolrRequest.METHOD.GET, "/diagnostics", null); req = createAutoScalingRequest(SolrRequest.METHOD.GET, "/diagnostics", null);
response = solrClient.request(req); response = solrClient.request(req);