[Uptime] update synthetics fleet telemetry tests (#117929)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Dominique Clarke 2021-11-15 11:21:47 -05:00 committed by GitHub
parent 1bf369e396
commit 75bd98bedd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 1357 deletions

View file

@ -40,13 +40,9 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
describe('with generated data', () => {
beforeEach('load heartbeat data', async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/uptime/blank');
await esArchiver.loadIfNeeded(
'x-pack/test/functional/es_archives/uptime/blank_data_stream'
);
});
after('unload', async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/uptime/blank');
await esArchiver.unload('x-pack/test/functional/es_archives/uptime/blank_data_stream');
});
loadTestFile(require.resolve('./certs'));

View file

@ -13,13 +13,43 @@ import { makeChecksWithStatus } from './helper/make_checks';
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const client = getService('es');
const testDataStreamName = 'synthetics-http-default';
describe('telemetry collectors fleet', () => {
const createDataStream = async (name: string) => {
// A data stream requires an index template before it can be created.
await client.indices.putIndexTemplate({
name,
body: {
// We need to match the names of backing indices with this template.
index_patterns: [name + '*'],
template: {
mappings: {
properties: {
'@timestamp': {
type: 'date',
},
},
},
},
data_stream: {},
},
});
await client.indices.createDataStream({ name });
};
const deleteComposableIndexTemplate = async (name: string) => {
await client.indices.deleteIndexTemplate({ name });
};
const deleteDataStream = async (name: string) => {
await client.indices.deleteDataStream({ name });
await deleteComposableIndexTemplate(name);
};
// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/111240
describe.skip('telemetry collectors fleet', () => {
before('generating data', async () => {
await getService('esArchiver').load(
'x-pack/test/functional/es_archives/uptime/blank_data_stream'
);
await createDataStream(testDataStreamName);
const observer = {
geo: {
@ -90,6 +120,7 @@ export default function ({ getService }: FtrProviderContext) {
undefined,
true
);
await makeChecksWithStatus(
client,
'downMonitorId',
@ -124,19 +155,8 @@ export default function ({ getService }: FtrProviderContext) {
await client.indices.refresh();
});
after('unload heartbeat index', () => {
getService('esArchiver').unload(
'x-pack/test/functional/es_archives/uptime/blank_data_stream'
);
/**
* Data streams aren't included in the javascript elasticsearch client in kibana yet so we
* need to do raw requests here. Delete a data stream is slightly different than that of a regular index which
* is why we're using _data_stream here.
*/
client.transport.request({
method: 'DELETE',
path: `_data_stream/synthetics-http-default`,
});
after('unload heartbeat index', async () => {
await deleteDataStream(testDataStreamName);
});
beforeEach(async () => {
@ -163,7 +183,7 @@ export default function ({ getService }: FtrProviderContext) {
monitor_page: 1,
no_of_unique_monitors: 4,
settings_page: 0,
monitor_frequency: [120, 0.001, 60, 60],
monitor_frequency: [0.001, 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 },
@ -171,7 +191,7 @@ export default function ({ getService }: FtrProviderContext) {
dateRangeEnd: ['now/d'],
autoRefreshEnabled: true,
autorefreshInterval: [100],
fleet_monitor_frequency: [120, 0.001, 60, 60],
fleet_monitor_frequency: [0.001, 0.001, 60, 60],
fleet_monitor_name_stats: { min_length: 7, max_length: 22, avg_length: 12 },
fleet_no_of_unique_monitors: 4,
});