Skip to content

Commit 80c93a7

Browse files
committed
Fix tests
1 parent a30ab44 commit 80c93a7

File tree

5 files changed

+1592
-396
lines changed

5 files changed

+1592
-396
lines changed

x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/__test__/get_paginated_nodes.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('getPaginatedNodes', () => {
5858
},
5959
},
6060
};
61-
const shardStats = {
61+
const nodesShardCount = {
6262
nodes: {
6363
1: {
6464
shardCount: 10,
@@ -78,7 +78,7 @@ describe('getPaginatedNodes', () => {
7878
pagination,
7979
sort,
8080
queryText,
81-
{ clusterStats, shardStats }
81+
{ clusterStats, nodesShardCount }
8282
);
8383
expect(nodes).toEqual({
8484
pageOfNodes: [
@@ -98,7 +98,7 @@ describe('getPaginatedNodes', () => {
9898
pagination,
9999
{ ...sort, field: 'foo', direction: 'desc' },
100100
queryText,
101-
{ clusterStats, shardStats }
101+
{ clusterStats, nodesShardCount }
102102
);
103103
expect(nodes).toEqual({
104104
pageOfNodes: [
@@ -118,7 +118,7 @@ describe('getPaginatedNodes', () => {
118118
pagination,
119119
sort,
120120
'tw',
121-
{ clusterStats, shardStats }
121+
{ clusterStats, nodesShardCount }
122122
);
123123
expect(nodes).toEqual({
124124
pageOfNodes: [{ name: 'two', uuid: 2, isOnline: false, shardCount: 5, foo: 12 }],

x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ export async function getNodesShardCount(req, esIndexPattern, cluster) {
4545
checkParam(esIndexPattern, 'esIndexPattern in elasticsearch/getShardStats');
4646

4747
const response = await getShardCountPerNode(req, esIndexPattern, cluster);
48-
return get(response, 'aggregations.nodes.buckets', []).reduce((accum, bucket) => {
48+
const nodes = get(response, 'aggregations.nodes.buckets', []).reduce((accum, bucket) => {
4949
accum[bucket.key] = { shardCount: bucket.doc_count };
5050
return accum;
5151
}, {});
52+
return { nodes };
5253
}

x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/index_detail.json

Lines changed: 53 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,6 @@
99
"totalShards": 10,
1010
"status": "green"
1111
},
12-
"logs": {
13-
"enabled": false,
14-
"limit": 10,
15-
"reason": {
16-
"clusterExists": false,
17-
"indexPatternExists": false,
18-
"indexPatternInTimeRangeExists": false,
19-
"typeExistsAtAnyTime": false,
20-
"usingStructuredLogs": false,
21-
"nodeExists": null,
22-
"indexExists": false,
23-
"typeExists": false
24-
},
25-
"logs": []
26-
},
2712
"metrics": {
2813
"index_search_request_rate": [
2914
{
@@ -1104,146 +1089,143 @@
11041089
}
11051090
]
11061091
},
1092+
"logs": {
1093+
"enabled": false,
1094+
"logs": [],
1095+
"reason": {
1096+
"indexPatternExists": false,
1097+
"indexPatternInTimeRangeExists": false,
1098+
"typeExistsAtAnyTime": false,
1099+
"typeExists": false,
1100+
"usingStructuredLogs": false,
1101+
"clusterExists": false,
1102+
"nodeExists": null,
1103+
"indexExists": false
1104+
},
1105+
"limit": 10
1106+
},
11071107
"shards": [
11081108
{
1109-
"state": "STARTED",
1110-
"primary": false,
1109+
"index": "avocado-tweets-2017.10.02",
11111110
"node": "xcP6ue7eRCieNNitFTT0EA",
1111+
"primary": false,
11121112
"relocating_node": null,
11131113
"shard": 4,
1114-
"index": "avocado-tweets-2017.10.02"
1114+
"state": "STARTED"
11151115
},
11161116
{
1117-
"state": "STARTED",
1118-
"primary": true,
1117+
"index": "avocado-tweets-2017.10.02",
11191118
"node": "jUT5KdxfRbORSCWkb5zjmA",
1119+
"primary": true,
11201120
"relocating_node": null,
11211121
"shard": 4,
1122-
"index": "avocado-tweets-2017.10.02"
1122+
"state": "STARTED"
11231123
},
11241124
{
1125-
"state": "STARTED",
1126-
"primary": true,
1125+
"index": "avocado-tweets-2017.10.02",
11271126
"node": "xcP6ue7eRCieNNitFTT0EA",
1127+
"primary": true,
11281128
"relocating_node": null,
11291129
"shard": 1,
1130-
"index": "avocado-tweets-2017.10.02"
1130+
"state": "STARTED"
11311131
},
11321132
{
1133-
"state": "STARTED",
1134-
"primary": false,
1133+
"index": "avocado-tweets-2017.10.02",
11351134
"node": "jUT5KdxfRbORSCWkb5zjmA",
1135+
"primary": false,
11361136
"relocating_node": null,
11371137
"shard": 1,
1138-
"index": "avocado-tweets-2017.10.02"
1138+
"state": "STARTED"
11391139
},
11401140
{
1141-
"state": "STARTED",
1142-
"primary": true,
1141+
"index": "avocado-tweets-2017.10.02",
11431142
"node": "xcP6ue7eRCieNNitFTT0EA",
1143+
"primary": true,
11441144
"relocating_node": null,
11451145
"shard": 2,
1146-
"index": "avocado-tweets-2017.10.02"
1146+
"state": "STARTED"
11471147
},
11481148
{
1149-
"state": "STARTED",
1150-
"primary": false,
1149+
"index": "avocado-tweets-2017.10.02",
11511150
"node": "jUT5KdxfRbORSCWkb5zjmA",
1151+
"primary": false,
11521152
"relocating_node": null,
11531153
"shard": 2,
1154-
"index": "avocado-tweets-2017.10.02"
1154+
"state": "STARTED"
11551155
},
11561156
{
1157-
"state": "STARTED",
1158-
"primary": false,
1157+
"index": "avocado-tweets-2017.10.02",
11591158
"node": "xcP6ue7eRCieNNitFTT0EA",
1159+
"primary": false,
11601160
"relocating_node": null,
11611161
"shard": 3,
1162-
"index": "avocado-tweets-2017.10.02"
1162+
"state": "STARTED"
11631163
},
11641164
{
1165-
"state": "STARTED",
1166-
"primary": true,
1165+
"index": "avocado-tweets-2017.10.02",
11671166
"node": "jUT5KdxfRbORSCWkb5zjmA",
1167+
"primary": true,
11681168
"relocating_node": null,
11691169
"shard": 3,
1170-
"index": "avocado-tweets-2017.10.02"
1170+
"state": "STARTED"
11711171
},
11721172
{
1173-
"state": "STARTED",
1174-
"primary": false,
1173+
"index": "avocado-tweets-2017.10.02",
11751174
"node": "xcP6ue7eRCieNNitFTT0EA",
1175+
"primary": false,
11761176
"relocating_node": null,
11771177
"shard": 0,
1178-
"index": "avocado-tweets-2017.10.02"
1178+
"state": "STARTED"
11791179
},
11801180
{
1181-
"state": "STARTED",
1182-
"primary": true,
1181+
"index": "avocado-tweets-2017.10.02",
11831182
"node": "jUT5KdxfRbORSCWkb5zjmA",
1183+
"primary": true,
11841184
"relocating_node": null,
11851185
"shard": 0,
1186-
"index": "avocado-tweets-2017.10.02"
1186+
"state": "STARTED"
11871187
}
11881188
],
11891189
"shardStats": {
11901190
"nodes": {
11911191
"jUT5KdxfRbORSCWkb5zjmA": {
1192-
"shardCount": 38,
1193-
"indexCount": 20,
1192+
"shardCount": 5,
1193+
"indexCount": 1,
11941194
"name": "whatever-01",
11951195
"node_ids": [
11961196
"jUT5KdxfRbORSCWkb5zjmA"
11971197
],
11981198
"type": "master"
11991199
},
12001200
"xcP6ue7eRCieNNitFTT0EA": {
1201-
"shardCount": 36,
1202-
"indexCount": 19,
1201+
"shardCount": 5,
1202+
"indexCount": 1,
12031203
"name": "whatever-02",
12041204
"node_ids": [
12051205
"xcP6ue7eRCieNNitFTT0EA"
12061206
],
12071207
"type": "node"
1208-
},
1209-
"bwQWH-7IQY-mFPpfoaoFXQ": {
1210-
"shardCount": 4,
1211-
"indexCount": 4,
1212-
"name": "whatever-03",
1213-
"node_ids": [
1214-
"bwQWH-7IQY-mFPpfoaoFXQ"
1215-
],
1216-
"type": "node"
12171208
}
12181209
}
12191210
},
12201211
"nodes": {
12211212
"jUT5KdxfRbORSCWkb5zjmA": {
1222-
"shardCount": 38,
1223-
"indexCount": 20,
1213+
"shardCount": 5,
1214+
"indexCount": 1,
12241215
"name": "whatever-01",
12251216
"node_ids": [
12261217
"jUT5KdxfRbORSCWkb5zjmA"
12271218
],
12281219
"type": "master"
12291220
},
12301221
"xcP6ue7eRCieNNitFTT0EA": {
1231-
"shardCount": 36,
1232-
"indexCount": 19,
1222+
"shardCount": 5,
1223+
"indexCount": 1,
12331224
"name": "whatever-02",
12341225
"node_ids": [
12351226
"xcP6ue7eRCieNNitFTT0EA"
12361227
],
12371228
"type": "node"
1238-
},
1239-
"bwQWH-7IQY-mFPpfoaoFXQ": {
1240-
"shardCount": 4,
1241-
"indexCount": 4,
1242-
"name": "whatever-03",
1243-
"node_ids": [
1244-
"bwQWH-7IQY-mFPpfoaoFXQ"
1245-
],
1246-
"type": "node"
12471229
}
12481230
},
12491231
"stateUuid": "6wwwErXyTfaa4uHBHG5Pbg"

0 commit comments

Comments
 (0)