-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Uptime] Improve Telemetry test #62428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5b36d9e
removed unnecessary filter
shahzad31 64c17c6
update condition
shahzad31 297384b
Merge branch 'master' into fix/issue-with-monitor-list-fetch
shahzad31 e6fa841
added a unit test for mix state
shahzad31 33d9603
fix types
shahzad31 66e0c2c
fix type
shahzad31 8d9f7bb
Merge branch 'master' into fix/issue-with-monitor-list-fetch
elasticmachine 5282d08
Merge branch 'master' into fix/issue-with-monitor-list-fetch
shahzad31 dd2e0fe
updated test
shahzad31 9cfc791
Merge branch 'fix/issue-with-monitor-list-fetch' of https://github.co…
shahzad31 1d21446
update
shahzad31 9d4716d
updates test
shahzad31 76bfdec
Merge branch 'fix/issue-with-monitor-list-fetch' into telemetry-test
shahzad31 a0e6014
updates tests
shahzad31 79f0f3a
updates tests
shahzad31 8a6d549
Merge branch 'master' into telemetry-test
shahzad31 ce1ed42
updated type
shahzad31 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
129 changes: 129 additions & 0 deletions
129
x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts
This file contains hidden or 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,129 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import expect from '@kbn/expect'; | ||
| import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
| import { API_URLS } from '../../../../../legacy/plugins/uptime/common/constants'; | ||
| import { makeChecksWithStatus } from '../graphql/helpers/make_checks'; | ||
|
|
||
| export default function({ getService }: FtrProviderContext) { | ||
| const supertest = getService('supertest'); | ||
| const es = getService('legacyEs'); | ||
|
|
||
| describe('telemetry collectors', () => { | ||
| before('generating data', async () => { | ||
| await getService('esArchiver').load('uptime/blank'); | ||
|
|
||
| const observer = { | ||
| geo: { | ||
| name: 'US-East', | ||
| location: '40.7128, -74.0060', | ||
| }, | ||
| }; | ||
|
|
||
| const observer2 = { | ||
| geo: { | ||
| name: 'US', | ||
| location: '40.7128, -74.0060', | ||
| }, | ||
| }; | ||
|
|
||
| await makeChecksWithStatus( | ||
| es, | ||
| 'upMonitorId', | ||
| 1, | ||
| 1, | ||
| 60 * 1000, | ||
| { | ||
| observer: {}, | ||
| monitor: { | ||
| name: 'Elastic', | ||
| }, | ||
| }, | ||
| 'up' | ||
| ); | ||
|
|
||
| await makeChecksWithStatus( | ||
| es, | ||
| 'downMonitorId', | ||
| 1, | ||
| 1, | ||
| 120 * 1000, | ||
| { | ||
| observer, | ||
| monitor: { | ||
| name: 'Long Name with 22 Char', | ||
| }, | ||
| }, | ||
| 'down' | ||
| ); | ||
|
|
||
| await makeChecksWithStatus(es, 'noGeoNameMonitor', 1, 1, 60 * 1000, { observer: {} }, 'down'); | ||
| await makeChecksWithStatus( | ||
| es, | ||
| 'downMonitorId', | ||
| 1, | ||
| 1, | ||
| 1, | ||
| { | ||
| observer, | ||
| monitor: { | ||
| name: 'Elastic', | ||
| }, | ||
| }, | ||
| 'down' | ||
| ); | ||
|
|
||
| await makeChecksWithStatus(es, 'mixMonitorId', 1, 1, 1, { observer: observer2 }, 'down'); | ||
| }); | ||
|
|
||
| after('unload heartbeat index', () => getService('esArchiver').unload('uptime/blank')); | ||
|
|
||
| it('should receive expected results after calling monitor/overview logging', async () => { | ||
| // call monitor page | ||
| await supertest | ||
| .post(API_URLS.LOG_PAGE_VIEW) | ||
| .set('kbn-xsrf', 'true') | ||
| .send({ | ||
| page: 'Monitor', | ||
| autorefreshInterval: 100, | ||
| dateStart: 'now/d', | ||
| dateEnd: 'now/d', | ||
| autoRefreshEnabled: true, | ||
| refreshTelemetryHistory: true, | ||
| }) | ||
| .expect(200); | ||
|
|
||
| // call overview page | ||
| const { body: result } = await supertest | ||
| .post(API_URLS.LOG_PAGE_VIEW) | ||
| .set('kbn-xsrf', 'true') | ||
| .send({ | ||
| page: 'Overview', | ||
| autorefreshInterval: 60, | ||
| dateStart: 'now/d', | ||
| dateEnd: 'now-30', | ||
| autoRefreshEnabled: true, | ||
| }) | ||
| .expect(200); | ||
|
|
||
| expect(result).to.eql({ | ||
| overview_page: 1, | ||
| monitor_page: 1, | ||
| no_of_unique_monitors: 4, | ||
| settings_page: 0, | ||
| monitor_frequency: [120, 0.001, 60, 60], | ||
| monitor_name_stats: { min_length: 7, max_length: 22, avg_length: 12 }, | ||
| no_of_unique_observer_locations: 3, | ||
| observer_location_name_stats: { min_length: 2, max_length: 7, avg_length: 4.8 }, | ||
| dateRangeStart: ['now/d', 'now/d'], | ||
| dateRangeEnd: ['now/d', 'now-30'], | ||
| autoRefreshEnabled: true, | ||
| autorefreshInterval: [100, 60], | ||
| }); | ||
| }); | ||
| }); | ||
| } |
21 changes: 0 additions & 21 deletions
21
x-pack/test/api_integration/apis/uptime/telemetry_collectors.ts
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.