You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2018/09/26 11:49:55 UTC

[24/45] lucene-solr:jira/solr-12709: SOLR-12792: extract test data into separate files in autoscaling tests

SOLR-12792: extract test data into separate files in autoscaling tests


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/1d604d1b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1d604d1b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1d604d1b

Branch: refs/heads/jira/solr-12709
Commit: 1d604d1b3ffe1560700e5e462e9e796646a30d7a
Parents: 6adeb5b
Author: Noble Paul <no...@apache.org>
Authored: Fri Sep 21 13:26:52 2018 +1000
Committer: Noble Paul <no...@apache.org>
Committed: Fri Sep 21 13:26:52 2018 +1000

----------------------------------------------------------------------
 .../testAutoScalingHandlerFailure.json          | 141 +++++++++++++++
 .../solrj/cloud/autoscaling/TestPolicy2.java    | 178 +------------------
 2 files changed, 143 insertions(+), 176 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1d604d1b/solr/solrj/src/test-files/solrj/solr/autoscaling/testAutoScalingHandlerFailure.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testAutoScalingHandlerFailure.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testAutoScalingHandlerFailure.json
new file mode 100644
index 0000000..97368c2
--- /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 file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1d604d1b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
----------------------------------------------------------------------
diff --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.java
index b274974..71c0287 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);