Skip to content

Commit 7df0cd0

Browse files
committed
Add test
1 parent 2987b75 commit 7df0cd0

4 files changed

Lines changed: 68 additions & 0 deletions

File tree

x-pack/plugins/monitoring/public/alerts/status.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ interface Props {
2020
export const AlertsStatus: React.FC<Props> = (props: Props) => {
2121
const { alerts, showBadge = false, showOnlyCount = false } = props;
2222

23+
if (!alerts) {
24+
return null;
25+
}
26+
2327
let atLeastOneDanger = false;
2428
const count = Object.values(alerts).reduce((cnt, alertStatus) => {
2529
if (alertStatus.states.length) {

x-pack/plugins/monitoring/public/directives/main/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
</a>
9191
<a
9292
ng-if="monitoringMain.instance && (monitoringMain.name === 'nodes' || monitoringMain.name === 'indices')"
93+
data-test-subj="esNodeDetailAdvancedLink"
9394
kbn-href="#/elasticsearch/{{ monitoringMain.name }}/{{ monitoringMain.resolver }}/advanced"
9495
class="euiTab"
9596
ng-class="{'euiTab-isSelected': monitoringMain.page === 'advanced'}"

x-pack/test/functional/apps/monitoring/elasticsearch/node_detail.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,64 @@ export default function ({ getService, getPageObjects }) {
103103
});
104104
});
105105
});
106+
107+
describe('Advanced', () => {
108+
describe('Active Nodes', () => {
109+
const { setup, tearDown } = getLifecycleMethods(getService, getPageObjects);
110+
111+
before(async () => {
112+
await setup('monitoring/singlecluster-three-nodes-shard-relocation', {
113+
from: 'Oct 5, 2017 @ 20:31:48.354',
114+
to: 'Oct 5, 2017 @ 20:35:12.176',
115+
});
116+
117+
// go to nodes listing
118+
await overview.clickEsNodes();
119+
expect(await nodesList.isOnListing()).to.be(true);
120+
});
121+
122+
after(async () => {
123+
await tearDown();
124+
});
125+
126+
afterEach(async () => {
127+
await PageObjects.monitoring.clickBreadcrumb('~breadcrumbEsNodes'); // return back for next test
128+
});
129+
130+
it('should show node summary of master node with 20 indices and 38 shards', async () => {
131+
await nodesList.clickRowByResolver('jUT5KdxfRbORSCWkb5zjmA');
132+
await nodeDetail.clickAdvanced();
133+
134+
expect(await nodeDetail.getSummary()).to.eql({
135+
transportAddress: 'Transport Address\n127.0.0.1:9300',
136+
jvmHeap: 'JVM Heap\n29%',
137+
freeDiskSpace: 'Free Disk Space\n173.9 GB (37.42%)',
138+
documentCount: 'Documents\n24.8k',
139+
dataSize: 'Data\n50.4 MB',
140+
indicesCount: 'Indices\n20',
141+
shardsCount: 'Shards\n38',
142+
nodeType: 'Type\nMaster Node',
143+
status: 'Status: Online',
144+
});
145+
});
146+
147+
it('should show node summary of data node with 4 indices and 4 shards', async () => {
148+
await nodesList.clickRowByResolver('bwQWH-7IQY-mFPpfoaoFXQ');
149+
await nodeDetail.clickAdvanced();
150+
151+
expect(await nodeDetail.getSummary()).to.eql({
152+
transportAddress: 'Transport Address\n127.0.0.1:9302',
153+
jvmHeap: 'JVM Heap\n17%',
154+
freeDiskSpace: 'Free Disk Space\n173.9 GB (37.42%)',
155+
documentCount: 'Documents\n240',
156+
dataSize: 'Data\n1.4 MB',
157+
indicesCount: 'Indices\n4',
158+
shardsCount: 'Shards\n4',
159+
nodeType: 'Type\nNode',
160+
status: 'Status: Online',
161+
});
162+
});
163+
});
164+
});
106165
});
107166
}

x-pack/test/functional/services/monitoring/elasticsearch_node_detail.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export function MonitoringElasticsearchNodeDetailProvider({ getService }) {
1919
const SUBJ_SUMMARY_STATUS = `${SUBJ_SUMMARY} > statusIcon`;
2020

2121
return new (class ElasticsearchNodeDetail {
22+
async clickAdvanced() {
23+
return testSubjects.click('esNodeDetailAdvancedLink');
24+
}
25+
2226
async getSummary() {
2327
return {
2428
transportAddress: await testSubjects.getVisibleText(SUBJ_SUMMARY_TRANSPORT_ADDRESS),

0 commit comments

Comments
 (0)