SOLR-10994: fixing test errors

This commit is contained in:
Noble Paul 2017-07-05 15:33:20 +09:30
parent 467c692d40
commit 43feb76df9
1 changed files with 18 additions and 4 deletions

View File

@ -595,6 +595,9 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
" ]," + " ]," +
" 'policy1':[" + " 'policy1':[" +
" {'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}" + " {'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}" +
" ]," +
" 'policy2':[" +
" {'replica':'<7', 'shard': '#EACH', 'node': '#ANY'}" +
" ]" + " ]" +
"}}"; "}}";
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setPolicyCommand); req = createAutoScalingRequest(SolrRequest.METHOD.POST, setPolicyCommand);
@ -624,7 +627,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
Map policies = (Map) response.get("policies"); Map policies = (Map) response.get("policies");
assertNotNull(policies); assertNotNull(policies);
assertEquals(2, policies.size()); assertEquals(3, policies.size());
assertNotNull(policies.get("xyz")); assertNotNull(policies.get("xyz"));
assertNotNull(policies.get("policy1")); assertNotNull(policies.get("policy1"));
@ -660,10 +663,21 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
assertEquals(0, violations.size()); assertEquals(0, violations.size());
// 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); CollectionAdminResponse adminResponse = CollectionAdminRequest.Create
create.setMaxShardsPerNode(10); .createCollection("readApiTestViolations", CONFIGSET_NAME, 1, 6)
CollectionAdminResponse adminResponse = create.process(solrClient); .setPolicy("policy2")
.setMaxShardsPerNode(10)
.process(solrClient);
assertTrue(adminResponse.isSuccess()); assertTrue(adminResponse.isSuccess());
setPolicyCommand = "{'set-policy': {" +
" 'policy2':[" +
" {'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}" +
" ]" +
"}}";
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setPolicyCommand);
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);