Apache Solr open-source search software
SOLR-12792: extract test data into separate files in autoscaling tests
Noble Paul1d604d1b3ffe
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testAutoScalingHandlerFailure.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testAutoScalingHandlerFailure.jsonnew file mode 100644index 00000000000..97368c2302e--- /dev/null+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testAutoScalingHandlerFailure.json@@ -0,0 +1,141 @@+{"diagnostics":{+ "sortedNodes":[{+ "node":"127.0.0.1:63191_solr",+ "isLive":true,+ "cores":3.0,+ "freedisk":680.908073425293,+ "heapUsage":24.97510064011647,+ "sysLoadAvg":272.75390625,+ "totaldisk":1037.938980102539,+ "replicas":{"readApiTestViolations":{"shard1":[{"core_node5":{+ "core":"readApiTestViolations_shard1_replica_n2",+ "leader":"true",+ "base_url":"https://127.0.0.1:63191/solr",+ "node_name":"127.0.0.1:63191_solr",+ "state":"active",+ "type":"NRT",+ "force_set_state":"false",+ "INDEX.sizeInGB":6.426125764846802E-8,+ "shard":"shard1",+ "collection":"readApiTestViolations"}},+ {"core_node7":{+ "core":"readApiTestViolations_shard1_replica_n4",+ "base_url":"https://127.0.0.1:63191/solr",+ "node_name":"127.0.0.1:63191_solr",+ "state":"active",+ "type":"NRT",+ "force_set_state":"false",+ "INDEX.sizeInGB":6.426125764846802E-8,+ "shard":"shard1",+ "collection":"readApiTestViolations"}},+ {"core_node12":{+ "core":"readApiTestViolations_shard1_replica_n10",+ "base_url":"https://127.0.0.1:63191/solr",+ "node_name":"127.0.0.1:63191_solr",+ "state":"active",+ "type":"NRT",+ "force_set_state":"false",+ "INDEX.sizeInGB":6.426125764846802E-8,+ "shard":"shard1",+ "collection":"readApiTestViolations"}}]}}},+ {+ "node":"127.0.0.1:63192_solr",+ "isLive":true,+ "cores":3.0,+ "freedisk":680.908073425293,+ "heapUsage":24.98878807983566,+ "sysLoadAvg":272.75390625,+ "totaldisk":1037.938980102539,+ "replicas":{"readApiTestViolations":{"shard1":[{"core_node3":{+ "core":"readApiTestViolations_shard1_replica_n1",+ "base_url":"https://127.0.0.1:63192/solr",+ "node_name":"127.0.0.1:63192_solr",+ "state":"active",+ "type":"NRT",+ "force_set_state":"false",+ "INDEX.sizeInGB":6.426125764846802E-8,+ "shard":"shard1",+ "collection":"readApiTestViolations"}},+ {"core_node9":{+ "core":"readApiTestViolations_shard1_replica_n6",+ "base_url":"https://127.0.0.1:63192/solr",+ "node_name":"127.0.0.1:63192_solr",+ "state":"active",+ "type":"NRT",+ "force_set_state":"false",+ "INDEX.sizeInGB":6.426125764846802E-8,+ "shard":"shard1",+ "collection":"readApiTestViolations"}},+ {"core_node11":{+ "core":"readApiTestViolations_shard1_replica_n8",+ "base_url":"https://127.0.0.1:63192/solr",+ "node_name":"127.0.0.1:63192_solr",+ "state":"active",+ "type":"NRT",+ "force_set_state":"false",+ "INDEX.sizeInGB":6.426125764846802E-8,+ "shard":"shard1",+ "collection":"readApiTestViolations"}}]}}},+ {+ "node":"127.0.0.1:63219_solr",+ "isLive":true,+ "cores":0.0,+ "freedisk":680.908073425293,+ "heapUsage":24.98878807983566,+ "sysLoadAvg":272.75390625,+ "totaldisk":1037.938980102539,+ "replicas":{}}],+ "liveNodes":["127.0.0.1:63191_solr",+ "127.0.0.1:63192_solr",+ "127.0.0.1:63219_solr"],+ "violations":[{+ "collection":"readApiTestViolations",+ "shard":"shard1",+ "node":"127.0.0.1:63191_solr",+ "violation":{+ "replica":{+ "NRT":3,+ "count":3},+ "delta":2.0},+ "clause":{+ "replica":"<3",+ "shard":"#EACH",+ "node":"#ANY",+ "collection":"readApiTestViolations"}},+ {+ "collection":"readApiTestViolations",+ "shard":"shard1",+ "node":"127.0.0.1:63192_solr",+ "violation":{+ "replica":{+ "NRT":3,+ "count":3},+ "delta":2.0},+ "clause":{+ "replica":"<2",+ "shard":"#EACH",+ "node":"#ANY",+ "collection":"readApiTestViolations"}}],+ "config":{+ "cluster-preferences":[{+ "minimize":"cores",+ "precision":3},+ {+ "maximize":"freedisk",+ "precision":100},+ {+ "minimize":"sysLoadAvg",+ "precision":10},+ {+ "minimize":"heapUsage",+ "precision":10}],+ "cluster-policy":[{+ "cores":"<10",+ "node":"#ANY"},+ {+ "replica":"<2",+ "shard":"#EACH",+ "node":"#ANY"},+ {+ "nodeRole":"overseer",+ "replica":0}]}}}\ No newline at end of filediff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.javaindex b2749746770..71c02871fed 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java@@ -291,182 +291,8 @@ public class TestPolicy2 extends SolrTestCaseJ4 {};}- public void testAutoScalingHandlerFailure() {- String diagnostics = "{" +- " 'diagnostics': {" +- " 'sortedNodes': [" +- " {" +- " 'node': '127.0.0.1:63191_solr'," +- " 'isLive': true," +- " 'cores': 3.0," +- " 'freedisk': 680.908073425293," +- " 'heapUsage': 24.97510064011647," +- " 'sysLoadAvg': 272.75390625," +- " 'totaldisk': 1037.938980102539," +- " 'replicas': {" +- " 'readApiTestViolations': {" +- " 'shard1': [" +- " {" +- " 'core_node5': {" +- " 'core': 'readApiTestViolations_shard1_replica_n2'," +- " 'leader': 'true'," +- " 'base_url': 'https://127.0.0.1:63191/solr'," +- " 'node_name': '127.0.0.1:63191_solr'," +- " 'state': 'active'," +- " 'type': 'NRT'," +- " 'force_set_state': 'false'," +- " 'INDEX.sizeInGB': 6.426125764846802E-8," +- " 'shard': 'shard1'," +- " 'collection': 'readApiTestViolations'" +- " }" +- " }," +- " {" +- " 'core_node7': {" +- " 'core': 'readApiTestViolations_shard1_replica_n4'," +- " 'base_url': 'https://127.0.0.1:63191/solr'," +- " 'node_name': '127.0.0.1:63191_solr'," +- " 'state': 'active'," +- " 'type': 'NRT'," +- " 'force_set_state': 'false'," +- " 'INDEX.sizeInGB': 6.426125764846802E-8," +- " 'shard': 'shard1'," +- " 'collection': 'readApiTestViolations'" +- " }" +- " }," +- " {" +- " 'core_node12': {" +- " 'core': 'readApiTestViolations_shard1_replica_n10'," +- " 'base_url': 'https://127.0.0.1:63191/solr'," +- " 'node_name': '127.0.0.1:63191_solr'," +- " 'state': 'active'," +- " 'type': 'NRT'," +- " 'force_set_state': 'false'," +- " 'INDEX.sizeInGB': 6.426125764846802E-8," +- " 'shard': 'shard1'," +- " 'collection': 'readApiTestViolations'" +- " }" +- " }" +- " ]" +- " }" +- " }" +- " }," +- " {" +- " 'node': '127.0.0.1:63192_solr'," +- " 'isLive': true," +- " 'cores': 3.0," +- " 'freedisk': 680.908073425293," +- " 'heapUsage': 24.98878807983566," +- " 'sysLoadAvg': 272.75390625," +- " 'totaldisk': 1037.938980102539," +- " 'replicas': {" +- " 'readApiTestViolations': {" +- " 'shard1': [" +- " {" +- " 'core_node3': {" +- " 'core': 'readApiTestViolations_shard1_replica_n1'," +- " 'base_url': 'https://127.0.0.1:63192/solr'," +- " 'node_name': '127.0.0.1:63192_solr'," +- " 'state': 'active'," +- " 'type': 'NRT'," +- " 'force_set_state': 'false'," +- " 'INDEX.sizeInGB': 6.426125764846802E-8," +- " 'shard': 'shard1'," +- " 'collection': 'readApiTestViolations'" +- " }" +- " }," +- " {" +- " 'core_node9': {" +- " 'core': 'readApiTestViolations_shard1_replica_n6'," +- " 'base_url': 'https://127.0.0.1:63192/solr'," +- " 'node_name': '127.0.0.1:63192_solr'," +- " 'state': 'active'," +- " 'type': 'NRT'," +- " 'force_set_state': 'false'," +- " 'INDEX.sizeInGB': 6.426125764846802E-8," +- " 'shard': 'shard1'," +- " 'collection': 'readApiTestViolations'" +- " }" +- " }," +- " {" +- " 'core_node11': {" +- " 'core': 'readApiTestViolations_shard1_replica_n8'," +- " 'base_url': 'https://127.0.0.1:63192/solr'," +- " 'node_name': '127.0.0.1:63192_solr'," +- " 'state': 'active'," +- " 'type': 'NRT'," +- " 'force_set_state': 'false'," +- " 'INDEX.sizeInGB': 6.426125764846802E-8," +- " 'shard': 'shard1'," +- " 'collection': 'readApiTestViolations'" +- " }" +- " }" +- " ]" +- " }" +- " }" +- " }," +- " {" +- " 'node': '127.0.0.1:63219_solr'," +- " 'isLive': true," +- " 'cores': 0.0," +- " 'freedisk': 680.908073425293," +- " 'heapUsage': 24.98878807983566," +- " 'sysLoadAvg': 272.75390625," +- " 'totaldisk': 1037.938980102539," +- " 'replicas': {}" +- " }" +- " ]," +- " 'liveNodes': [" +- " '127.0.0.1:63191_solr'," +- " '127.0.0.1:63192_solr'," +- " '127.0.0.1:63219_solr'" +- " ]," +- " 'violations': [" +- " {" +- " 'collection': 'readApiTestViolations'," +- " 'shard': 'shard1'," +- " 'node': '127.0.0.1:63191_solr'," +- " 'violation': {" +- " 'replica': {'NRT': 3, 'count': 3}," +- " 'delta': 2.0" +- " }," +- " 'clause': {" +- " 'replica': '<3'," +- " 'shard': '#EACH'," +- " 'node': '#ANY'," +- " 'collection': 'readApiTestViolations'" +- " }" +- " }," +- " {" +- " 'collection': 'readApiTestViolations'," +- " 'shard': 'shard1'," +- " 'node': '127.0.0.1:63192_solr'," +- " 'violation': {" +- " 'replica': {'NRT': 3, 'count': 3}," +- " 'delta': 2.0" +- " }," +- " 'clause': {" +- " 'replica': '<2'," +- " 'shard': '#EACH'," +- " 'node': '#ANY'," +- " 'collection': 'readApiTestViolations'" +- " }" +- " }" +- " ]," +- " 'config': {" +- " 'cluster-preferences': [" +- " {'minimize': 'cores', 'precision': 3}," +- " {'maximize': 'freedisk', 'precision': 100}," +- " {'minimize': 'sysLoadAvg', 'precision': 10}," +- " {'minimize': 'heapUsage', 'precision': 10}" +- " ]," +- " 'cluster-policy': [" +- " {'cores': '<10', 'node': '#ANY'}," +- " {'replica': '<2', 'shard': '#EACH', 'node': '#ANY'}," +- " {'nodeRole': 'overseer', 'replica': 0}" +- " ]" +- " }" +- " }}";- Map<String, Object> m = (Map<String, Object>) Utils.fromJSONString(diagnostics);+ public void testAutoScalingHandlerFailure() throws IOException {+ Map<String, Object> m = (Map<String, Object>) loadFromResource("testAutoScalingHandlerFailure.json");Policy policy = new Policy((Map<String, Object>) Utils.getObjectByPath(m, false, "diagnostics/config"));SolrCloudManager cloudManagerFromDiagnostics = createCloudManagerFromDiagnostics(m);