[GitHub] [lucene-solr] madrob commented on a change in pull request #1598: SOLR-14409: Existing violations allow bypassing policy rules when add…
madrob commented on a change in pull request #1598: URL: https://github.com/apache/lucene-solr/pull/1598#discussion_r445653717 ## File path: solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java ## @@ -516,6 +517,16 @@ public void testInfiniteLoop() { System.out.println(suggestions); } + public void testAddTooManyPerPolicy() { +Map m = (Map) loadFromResource("testAddTooManyPerPolicy.json"); +SolrCloudManager cloudManagerFromDiagnostics = createCloudManagerFromDiagnostics(m); +AutoScalingConfig autoScalingConfig = new AutoScalingConfig((Map) getObjectByPath(m, false, "diagnostics/config")); +SolrException exp = expectThrows(SolrException.class, () -> PolicyHelper.getReplicaLocations("TooManyPerPolicy", autoScalingConfig, cloudManagerFromDiagnostics, +EMPTY_MAP, Collections.singletonList("shard1"), 1, 0, 0, null)); +assertTrue(exp.getMessage().contains("No node can satisfy the rules")); Review comment: You get a better error message when the test fails. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[GitHub] [lucene-solr] madrob commented on a change in pull request #1598: SOLR-14409: Existing violations allow bypassing policy rules when add…
madrob commented on a change in pull request #1598: URL: https://github.com/apache/lucene-solr/pull/1598#discussion_r444323329 ## File path: solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java ## @@ -516,6 +517,16 @@ public void testInfiniteLoop() { System.out.println(suggestions); } + public void testAddTooManyPerPolicy() { +Map m = (Map) loadFromResource("testAddTooManyPerPolicy.json"); +SolrCloudManager cloudManagerFromDiagnostics = createCloudManagerFromDiagnostics(m); +AutoScalingConfig autoScalingConfig = new AutoScalingConfig((Map) getObjectByPath(m, false, "diagnostics/config")); +SolrException exp = expectThrows(SolrException.class, () -> PolicyHelper.getReplicaLocations("TooManyPerPolicy", autoScalingConfig, cloudManagerFromDiagnostics, +EMPTY_MAP, Collections.singletonList("shard1"), 1, 0, 0, null)); +assertTrue(exp.getMessage().contains("No node can satisfy the rules")); Review comment: `assertThat(exp.getMessage(), contains("..."))` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org