[Uptime] Add both both ip filters for view host in uptime location for host and monitor (#155382)

This commit is contained in:
Shahzad 2023-04-20 15:17:09 +02:00 committed by GitHub
parent 5de52e84d5
commit c13a3ab603
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

View file

@ -21,7 +21,9 @@ describe('uptimeOverviewNavigatorParams', () => {
it('creates a path with expected search when ip is specified', async () => {
const location = await uptimeOverviewNavigatorParams.getLocation({ ip: '127.0.0.1' });
expect(location.path).toEqual(`${OVERVIEW_ROUTE}?search=monitor.ip: "127.0.0.1"`);
expect(location.path).toEqual(
`${OVERVIEW_ROUTE}?search=host.ip: "127.0.0.1" OR monitor.ip: "127.0.0.1"`
);
});
it('creates a path with expected search when hostname is specified', async () => {
@ -35,7 +37,7 @@ describe('uptimeOverviewNavigatorParams', () => {
ip: '127.0.0.1',
});
expect(location.path).toEqual(
`${OVERVIEW_ROUTE}?search=host.name: "elastic.co" OR host.ip: "127.0.0.1"`
`${OVERVIEW_ROUTE}?search=host.name: "elastic.co" OR host.ip: "127.0.0.1" OR monitor.ip: "127.0.0.1"`
);
});
@ -45,7 +47,7 @@ describe('uptimeOverviewNavigatorParams', () => {
ip: '10.0.0.1',
});
expect(location.path).toEqual(
`${OVERVIEW_ROUTE}?search=kubernetes.pod.uid: "foo" OR monitor.ip: "10.0.0.1"`
`${OVERVIEW_ROUTE}?search=kubernetes.pod.uid: "foo" OR host.ip: "10.0.0.1" OR monitor.ip: "10.0.0.1"`
);
});

View file

@ -28,8 +28,8 @@ async function navigate({
if (pod) searchParams.push(formatSearchKey('kubernetes.pod.uid', pod));
if (ip) {
const root = host ? 'host' : 'monitor';
searchParams.push(formatSearchKey(`${root}.ip`, ip));
searchParams.push(formatSearchKey(`host.ip`, ip));
searchParams.push(formatSearchKey(`monitor.ip`, ip));
}
const searchString = searchParams.join(' OR ');

View file

@ -12,4 +12,8 @@ const path = require('path');
const e2eDir = path.join(__dirname, '../e2e');
executeSyntheticsRunner(e2eDir);
try {
executeSyntheticsRunner(e2eDir);
} catch (e) {
console.log(e);
}