Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline committed Jul 17, 2020
1 parent 2987b75 commit 7df0cd0
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
4 changes: 4 additions & 0 deletions x-pack/plugins/monitoring/public/alerts/status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ interface Props {
export const AlertsStatus: React.FC<Props> = (props: Props) => {
const { alerts, showBadge = false, showOnlyCount = false } = props;

if (!alerts) {
return null;
}

let atLeastOneDanger = false;
const count = Object.values(alerts).reduce((cnt, alertStatus) => {
if (alertStatus.states.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
</a>
<a
ng-if="monitoringMain.instance && (monitoringMain.name === 'nodes' || monitoringMain.name === 'indices')"
data-test-subj="esNodeDetailAdvancedLink"
kbn-href="#/elasticsearch/{{ monitoringMain.name }}/{{ monitoringMain.resolver }}/advanced"
class="euiTab"
ng-class="{'euiTab-isSelected': monitoringMain.page === 'advanced'}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,64 @@ export default function ({ getService, getPageObjects }) {
});
});
});

describe('Advanced', () => {
describe('Active Nodes', () => {
const { setup, tearDown } = getLifecycleMethods(getService, getPageObjects);

before(async () => {
await setup('monitoring/singlecluster-three-nodes-shard-relocation', {
from: 'Oct 5, 2017 @ 20:31:48.354',
to: 'Oct 5, 2017 @ 20:35:12.176',
});

// go to nodes listing
await overview.clickEsNodes();
expect(await nodesList.isOnListing()).to.be(true);
});

after(async () => {
await tearDown();
});

afterEach(async () => {
await PageObjects.monitoring.clickBreadcrumb('~breadcrumbEsNodes'); // return back for next test
});

it('should show node summary of master node with 20 indices and 38 shards', async () => {
await nodesList.clickRowByResolver('jUT5KdxfRbORSCWkb5zjmA');
await nodeDetail.clickAdvanced();

expect(await nodeDetail.getSummary()).to.eql({
transportAddress: 'Transport Address\n127.0.0.1:9300',
jvmHeap: 'JVM Heap\n29%',
freeDiskSpace: 'Free Disk Space\n173.9 GB (37.42%)',
documentCount: 'Documents\n24.8k',
dataSize: 'Data\n50.4 MB',
indicesCount: 'Indices\n20',
shardsCount: 'Shards\n38',
nodeType: 'Type\nMaster Node',
status: 'Status: Online',
});
});

it('should show node summary of data node with 4 indices and 4 shards', async () => {
await nodesList.clickRowByResolver('bwQWH-7IQY-mFPpfoaoFXQ');
await nodeDetail.clickAdvanced();

expect(await nodeDetail.getSummary()).to.eql({
transportAddress: 'Transport Address\n127.0.0.1:9302',
jvmHeap: 'JVM Heap\n17%',
freeDiskSpace: 'Free Disk Space\n173.9 GB (37.42%)',
documentCount: 'Documents\n240',
dataSize: 'Data\n1.4 MB',
indicesCount: 'Indices\n4',
shardsCount: 'Shards\n4',
nodeType: 'Type\nNode',
status: 'Status: Online',
});
});
});
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export function MonitoringElasticsearchNodeDetailProvider({ getService }) {
const SUBJ_SUMMARY_STATUS = `${SUBJ_SUMMARY} > statusIcon`;

return new (class ElasticsearchNodeDetail {
async clickAdvanced() {
return testSubjects.click('esNodeDetailAdvancedLink');
}

async getSummary() {
return {
transportAddress: await testSubjects.getVisibleText(SUBJ_SUMMARY_TRANSPORT_ADDRESS),
Expand Down

0 comments on commit 7df0cd0

Please sign in to comment.