-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Uptime] Monitor Details - fallback to saved objects when monitor det…
…ails are unavailable from last ping (#125333) * uptime - synthetic service - fallback to saved objects when monitor details cannot be found * fix monitor url * fix tests
- Loading branch information
1 parent
97bd50d
commit f1fcbe7
Showing
11 changed files
with
199 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
x-pack/plugins/uptime/e2e/journeys/monitor_details.journey.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { journey, step, expect, before, Page } from '@elastic/synthetics'; | ||
import { monitorManagementPageProvider } from '../page_objects/monitor_management'; | ||
|
||
journey('MontiorDetails', async ({ page, params }: { page: Page; params: any }) => { | ||
const uptime = monitorManagementPageProvider({ page, kibanaUrl: params.kibanaUrl }); | ||
|
||
before(async () => { | ||
await uptime.waitForLoadingToFinish(); | ||
}); | ||
|
||
step('Go to monitor-management', async () => { | ||
await uptime.navigateToMonitorManagement(); | ||
}); | ||
|
||
step('login to Kibana', async () => { | ||
await uptime.loginToKibana(); | ||
const invalid = await page.locator(`text=Username or password is incorrect. Please try again.`); | ||
expect(await invalid.isVisible()).toBeFalsy(); | ||
}); | ||
|
||
step('navigate to monitor details page', async () => { | ||
await uptime.assertText({ text: 'Test Monitor' }); | ||
await Promise.all([page.waitForNavigation(), page.click('text="Test Monitor"')]); | ||
await uptime.assertText({ text: 'Test Monitor' }); | ||
const url = await page.textContent('[data-test-subj="monitor-page-url"]'); | ||
const type = await page.textContent('[data-test-subj="monitor-page-type"]'); | ||
expect(url).toEqual('https://www.google.com(opens in a new tab or window)'); | ||
expect(type).toEqual('HTTP'); | ||
}); | ||
}); |
20 changes: 2 additions & 18 deletions
20
...e/public/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
x-pack/plugins/uptime/public/state/reducers/monitor_status.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import { Action } from 'redux-actions'; | ||
|
||
import { monitorStatusReducer, MonitorStatusState, MonitorStatusPayload } from './monitor_status'; | ||
import { getMonitorStatusAction } from '../actions/monitor_status'; | ||
|
||
describe('selectedFiltersReducer', () => { | ||
let state: MonitorStatusState; | ||
|
||
beforeEach(() => { | ||
state = { | ||
loading: false, | ||
status: { | ||
timestamp: '', | ||
docId: '', | ||
monitor: { | ||
id: 'testid', | ||
status: 'up', | ||
duration: { | ||
us: 1, | ||
}, | ||
type: 'browser', | ||
}, | ||
}, | ||
}; | ||
}); | ||
|
||
describe('setSelectedFilters', () => { | ||
it('sets state to the action payload if state is null', () => { | ||
state.status = { | ||
timestamp: '', | ||
docId: '', | ||
monitor: { | ||
id: 'testid', | ||
status: 'up', | ||
duration: { | ||
us: 1, | ||
}, | ||
type: 'browser', | ||
}, | ||
}; | ||
expect( | ||
monitorStatusReducer( | ||
state, | ||
getMonitorStatusAction({ | ||
monitorId: 'testid2', | ||
dateStart: 'start', | ||
dateEnd: 'end', | ||
}) as Action<MonitorStatusPayload> | ||
) | ||
).toEqual({ | ||
loading: true, | ||
status: null, | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { SavedObject, SavedObjectsClientContract } from 'kibana/server'; | ||
import { SyntheticsMonitor } from '../../../common/runtime_types'; | ||
import { syntheticsMonitorType } from '../../lib/saved_objects/synthetics_monitor'; | ||
|
||
export const getSyntheticsMonitor = async ({ | ||
monitorId, | ||
savedObjectsClient, | ||
}: { | ||
monitorId: string; | ||
savedObjectsClient: SavedObjectsClientContract; | ||
}): Promise<SavedObject<SyntheticsMonitor>> => { | ||
try { | ||
return await savedObjectsClient.get(syntheticsMonitorType, monitorId); | ||
} catch (e) { | ||
throw e; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters