From 8d8c629425d2f0369c08d34baf48654dd5326b0a Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Wed, 16 Aug 2017 13:09:20 +0530 Subject: [PATCH] SOLR-11243: Fix for the AutoScalingHandlerTest.testReadApi --- .../cloud/autoscaling/AutoScalingHandlerTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java index 9250e8c914c..c752253e51f 100644 --- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java @@ -284,12 +284,24 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase { assertNotNull(violations); 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 CollectionAdminRequest.Create create = CollectionAdminRequest.Create.createCollection("readApiTestViolations", CONFIGSET_NAME, 1, 6); create.setMaxShardsPerNode(10); CollectionAdminResponse adminResponse = create.process(solrClient); 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 req = createAutoScalingRequest(SolrRequest.METHOD.GET, "/diagnostics", null); response = solrClient.request(req);