From 92dd341f5c3e354bce5f7d43760af79d79c86267 Mon Sep 17 00:00:00 2001 From: Chris Roberson Date: Tue, 24 Jul 2018 12:56:10 -0400 Subject: [PATCH] [Monitoring] Use 0 as the default for shard count if the node is not found (#21000) * Use 0 as the default for shard count if the node is not found * Remove debug * Updating snapshot tests * Update api integration test --- .../__test__/__snapshots__/handle_response.test.js.snap | 4 ++-- .../__test__/__snapshots__/map_nodes_info.test.js.snap | 2 +- .../lib/elasticsearch/nodes/get_nodes/map_nodes_info.js | 2 +- .../monitoring/elasticsearch/fixtures/nodes_listing_red.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/__test__/__snapshots__/handle_response.test.js.snap b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/__test__/__snapshots__/handle_response.test.js.snap index 31afcf2c8aa7..cb16feaed5ed 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/__test__/__snapshots__/handle_response.test.js.snap +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/__test__/__snapshots__/handle_response.test.js.snap @@ -151,7 +151,7 @@ Array [ }, }, "resolver": "_x_V2YzPQU-a9KRRBxUxZQ", - "shardCount": null, + "shardCount": 0, "transport_address": "127.0.0.1:9300", "type": "master", }, @@ -260,7 +260,7 @@ Array [ }, }, "resolver": "DAiX7fFjS3Wii7g2HYKrOg", - "shardCount": null, + "shardCount": 0, "transport_address": "127.0.0.1:9301", "type": "node", }, diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/__test__/__snapshots__/map_nodes_info.test.js.snap b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/__test__/__snapshots__/map_nodes_info.test.js.snap index 311733ddfbe2..9f75dd1f1ee0 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/__test__/__snapshots__/map_nodes_info.test.js.snap +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/__test__/__snapshots__/map_nodes_info.test.js.snap @@ -16,7 +16,7 @@ Object { "name": "node02", "nodeTypeClass": "fa-server", "nodeTypeLabel": "Node", - "shardCount": null, + "shardCount": 0, "transport_address": "127.0.0.1:9301", "type": "node", }, diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_info.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_info.js index f9316e5701db..6c39d72770c2 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_info.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_info.js @@ -35,7 +35,7 @@ export function mapNodesInfo(nodeHits, clusterStats, shardStats) { isOnline, nodeTypeLabel: nodeTypeLabel, nodeTypeClass: nodeTypeClass, - shardCount: get(shardStats, `nodes[${sourceNode.uuid}].shardCount`, null), + shardCount: get(shardStats, `nodes[${sourceNode.uuid}].shardCount`, 0), } }; }, {}); diff --git a/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/nodes_listing_red.json b/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/nodes_listing_red.json index 43023799f69b..54365001be2d 100644 --- a/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/nodes_listing_red.json +++ b/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/nodes_listing_red.json @@ -109,7 +109,7 @@ "nodeTypeClass": "fa-server", "nodeTypeLabel": "Node", "resolver": "1jxg5T33TWub-jJL4qP0Wg", - "shardCount": null, + "shardCount": 0, "transport_address": "127.0.0.1:9302", "type": "node" }