diff --git a/x-pack/test/api_integration/apis/synthetics/add_monitor_private_location.ts b/x-pack/test/api_integration/apis/synthetics/add_monitor_private_location.ts index 724c1cde7334f..1855770a19525 100644 --- a/x-pack/test/api_integration/apis/synthetics/add_monitor_private_location.ts +++ b/x-pack/test/api_integration/apis/synthetics/add_monitor_private_location.ts @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import semver from 'semver'; import uuid from 'uuid'; import { ConfigKey, HTTPFields } from '@kbn/synthetics-plugin/common/runtime_types'; import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; @@ -363,11 +364,6 @@ export default function ({ getService }: FtrProviderContext) { expect(packagePolicy.package.version).eql('0.10.3'); - await supertestAPI - .post('/api/fleet/epm/packages/synthetics/0.11.3') - .set('kbn-xsrf', 'true') - .send({ force: true }); - await supertestAPI.post('/api/fleet/setup').set('kbn-xsrf', 'true').send().expect(200); const policyResponseAfterUpgrade = await supertestAPI.get( '/api/fleet/package_policies?page=1&perPage=2000&kuery=ingest-package-policies.package.name%3A%20synthetics' @@ -376,7 +372,7 @@ export default function ({ getService }: FtrProviderContext) { (pkgPolicy: PackagePolicy) => pkgPolicy.id === monitorId + '-' + testFleetPolicyID + `-default` ); - expect(packagePolicyAfterUpgrade.package.version).eql('0.11.3'); + expect(semver.gt(packagePolicyAfterUpgrade.package.version, '0.10.3')).eql(true); } finally { await supertestAPI .delete(API_URLS.SYNTHETICS_MONITORS + '/' + monitorId) diff --git a/x-pack/test/api_integration/apis/synthetics/get_monitor_overview.ts b/x-pack/test/api_integration/apis/synthetics/get_monitor_overview.ts index 89bbb5f46108a..0aa940941f98a 100644 --- a/x-pack/test/api_integration/apis/synthetics/get_monitor_overview.ts +++ b/x-pack/test/api_integration/apis/synthetics/get_monitor_overview.ts @@ -102,151 +102,151 @@ export default function ({ getService }: FtrProviderContext) { await security.role.delete(roleName); }); - describe('returns total number of monitor combinations', () => { - it('returns the correct response', async () => { - let savedMonitors: SimpleSavedObject[] = []; - try { - const savedResponse = await Promise.all(monitors.map(saveMonitor)); - savedMonitors = savedResponse; - - const apiResponse = await supertest.get( - `/s/${SPACE_ID}${SYNTHETICS_API_URLS.SYNTHETICS_OVERVIEW}` - ); - - expect(apiResponse.body.total).eql(monitors.length * 2); - expect(apiResponse.body.allMonitorIds.sort()).eql( - savedMonitors.map((monitor) => monitor.id).sort() - ); - expect(apiResponse.body.monitors.length).eql(40); - } finally { - await Promise.all( - savedMonitors.map((monitor) => { - return deleteMonitor(monitor.id); - }) - ); - } - }); + it('returns the correct response', async () => { + let savedMonitors: SimpleSavedObject[] = []; + try { + const savedResponse = await Promise.all(monitors.map(saveMonitor)); + savedMonitors = savedResponse; + + const apiResponse = await supertest.get( + `/s/${SPACE_ID}${SYNTHETICS_API_URLS.SYNTHETICS_OVERVIEW}` + ); + + expect(apiResponse.body.total).eql(monitors.length * 2); + expect(apiResponse.body.allMonitorIds.sort()).eql( + savedMonitors.map((monitor) => monitor.id).sort() + ); + expect(apiResponse.body.monitors.length).eql(40); + } finally { + await Promise.all( + savedMonitors.map((monitor) => { + return deleteMonitor(monitor.id); + }) + ); + } + }); - it('accepts search queries', async () => { - let savedMonitors: Array> = []; - try { - const savedResponse = await Promise.all(monitors.map(saveMonitor)); - savedMonitors = savedResponse; - - const apiResponse = await supertest - .get(`/s/${SPACE_ID}${SYNTHETICS_API_URLS.SYNTHETICS_OVERVIEW}`) - .query({ - query: '19', - }); - - expect(apiResponse.body.total).eql(2); - expect(apiResponse.body.allMonitorIds.sort()).eql( - savedMonitors - .filter((monitor) => monitor.attributes.name.includes('19')) - .map((monitor) => monitor.id) - ); - expect(apiResponse.body.monitors.length).eql(2); - } finally { - await Promise.all( - savedMonitors.map((monitor) => { - return deleteMonitor(monitor.id); - }) - ); - } - }); + it('accepts search queries', async () => { + let savedMonitors: Array> = []; + try { + const savedResponse = await Promise.all(monitors.map(saveMonitor)); + savedMonitors = savedResponse; + + const apiResponse = await supertest + .get(`/s/${SPACE_ID}${SYNTHETICS_API_URLS.SYNTHETICS_OVERVIEW}`) + .query({ + query: '19', + }); + + expect(apiResponse.body.total).eql(2); + expect(apiResponse.body.allMonitorIds.sort()).eql( + savedMonitors + .filter((monitor) => monitor.attributes.name.includes('19')) + .map((monitor) => monitor.id) + ); + expect(apiResponse.body.monitors.length).eql(2); + } finally { + await Promise.all( + savedMonitors.map((monitor) => { + return deleteMonitor(monitor.id); + }) + ); + } }); - describe('Overview Item', () => { - it('returns the correct response', async () => { - let savedMonitors: Array> = []; - const customHeartbeatId = 'example_custom_heartbeat_id'; - try { - const savedResponse = await Promise.all( - [ - monitors[0], - { ...monitors[1], custom_heartbeat_id: 'example_custom_heartbeat_id' }, - ].map(saveMonitor) - ); - savedMonitors = savedResponse; - - const apiResponse = await supertest.get( - `/s/${SPACE_ID}${SYNTHETICS_API_URLS.SYNTHETICS_OVERVIEW}` - ); - expect(apiResponse.body.monitors).eql([ + it('returns the correct response', async () => { + let savedMonitors: Array> = []; + const customHeartbeatId = 'example_custom_heartbeat_id'; + try { + const savedResponse = await Promise.all( + [ + { ...monitors[0], name: 'test monitor a' }, { - id: savedMonitors[0].attributes[ConfigKey.MONITOR_QUERY_ID], - configId: savedMonitors[0].id, - name: 'test-monitor-name 0', - location: { - id: 'eu-west-01', - label: 'Europe West', - geo: { - lat: 33.2343132435, - lon: 73.2342343434, - }, - url: 'https://example-url.com', - isServiceManaged: true, + ...monitors[1], + custom_heartbeat_id: 'example_custom_heartbeat_id', + name: 'test monitor b', + }, + ].map(saveMonitor) + ); + savedMonitors = savedResponse; + + const apiResponse = await supertest.get( + `/s/${SPACE_ID}${SYNTHETICS_API_URLS.SYNTHETICS_OVERVIEW}` + ); + expect(apiResponse.body.monitors).eql([ + { + id: savedMonitors[0].attributes[ConfigKey.MONITOR_QUERY_ID], + configId: savedMonitors[0].id, + name: 'test monitor a', + location: { + id: 'eu-west-01', + label: 'Europe West', + geo: { + lat: 33.2343132435, + lon: 73.2342343434, }, - isEnabled: true, + url: 'https://example-url.com', + isServiceManaged: true, }, - { - id: savedMonitors[0].attributes[ConfigKey.MONITOR_QUERY_ID], - configId: savedMonitors[0].id, - name: 'test-monitor-name 0', - location: { - id: 'eu-west-02', - label: 'Europe West', - geo: { - lat: 33.2343132435, - lon: 73.2342343434, - }, - url: 'https://example-url.com', - isServiceManaged: true, + isEnabled: true, + }, + { + id: savedMonitors[0].attributes[ConfigKey.MONITOR_QUERY_ID], + configId: savedMonitors[0].id, + name: 'test monitor a', + location: { + id: 'eu-west-02', + label: 'Europe West', + geo: { + lat: 33.2343132435, + lon: 73.2342343434, }, - isEnabled: true, + url: 'https://example-url.com', + isServiceManaged: true, }, - { - id: savedMonitors[1].attributes[ConfigKey.MONITOR_QUERY_ID], - configId: savedMonitors[1].id, - name: 'test-monitor-name 1', - location: { - id: 'eu-west-01', - label: 'Europe West', - geo: { - lat: 33.2343132435, - lon: 73.2342343434, - }, - url: 'https://example-url.com', - isServiceManaged: true, + isEnabled: true, + }, + { + id: savedMonitors[1].attributes[ConfigKey.MONITOR_QUERY_ID], + configId: savedMonitors[1].id, + name: 'test monitor b', + location: { + id: 'eu-west-01', + label: 'Europe West', + geo: { + lat: 33.2343132435, + lon: 73.2342343434, }, - isEnabled: true, + url: 'https://example-url.com', + isServiceManaged: true, }, - { - id: savedMonitors[1].attributes[ConfigKey.MONITOR_QUERY_ID], - configId: savedMonitors[1].id, - name: 'test-monitor-name 1', - location: { - id: 'eu-west-02', - label: 'Europe West', - geo: { - lat: 33.2343132435, - lon: 73.2342343434, - }, - url: 'https://example-url.com', - isServiceManaged: true, + isEnabled: true, + }, + { + id: savedMonitors[1].attributes[ConfigKey.MONITOR_QUERY_ID], + configId: savedMonitors[1].id, + name: 'test monitor b', + location: { + id: 'eu-west-02', + label: 'Europe West', + geo: { + lat: 33.2343132435, + lon: 73.2342343434, }, - isEnabled: true, + url: 'https://example-url.com', + isServiceManaged: true, }, - ]); - expect(savedMonitors[1].attributes[ConfigKey.MONITOR_QUERY_ID]).eql(customHeartbeatId); - } finally { - await Promise.all( - savedMonitors.map((monitor) => { - return deleteMonitor(monitor.id); - }) - ); - } - }); + isEnabled: true, + }, + ]); + expect(savedMonitors[1].attributes[ConfigKey.MONITOR_QUERY_ID]).eql(customHeartbeatId); + } finally { + await Promise.all( + savedMonitors.map((monitor) => { + return deleteMonitor(monitor.id); + }) + ); + } }); }); }