Improve mobile API tests (#156578)

There were some comments regarding the api test done for the mobile
transactions main and detailed statistics as part of this
[PR](https://github.com/elastic/kibana/pull/153044)

### Summary
- add value specific test not just check if the response is empty
(detailed statistics timeseries test)
- calculate values based on the inputs for generating data, instead of
like snapshot testing (throughput)

This PR also contains the fixes for the following failing skipped tests 
- https://github.com/elastic/kibana/issues/156207
- https://github.com/elastic/kibana/issues/156218
This commit is contained in:
Miriam 2023-05-16 17:26:43 +01:00 committed by GitHub
parent 927743ae52
commit b35265b96c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 552 additions and 60 deletions

View file

@ -93,7 +93,8 @@ export default function ApiTest({ getService }: FtrProviderContext) {
environment: 'production',
field: 'service.version',
});
expect(isEmpty(response.currentPeriod)).to.be.equal(false);
expect(Object.keys(response.currentPeriod)).to.be.eql(['2.3', '1.1', '1.2']);
expect(isEmpty(response.previousPeriod)).to.be.equal(true);
});
});
@ -110,8 +111,12 @@ export default function ApiTest({ getService }: FtrProviderContext) {
});
});
it('returns some data for both periods', async () => {
expect(isEmpty(mobiledetailedStatisticResponse.currentPeriod)).to.be.equal(false);
expect(isEmpty(mobiledetailedStatisticResponse.previousPeriod)).to.be.equal(false);
expect(Object.keys(mobiledetailedStatisticResponse.currentPeriod).sort()).to.be.eql(
SERVICE_VERSIONS.sort()
);
expect(Object.keys(mobiledetailedStatisticResponse.previousPeriod).sort()).to.be.eql(
SERVICE_VERSIONS.sort()
);
});
it('returns same number of buckets for both periods', () => {

View file

@ -6,14 +6,173 @@
*/
import expect from '@kbn/expect';
import { apm, timerange } from '@kbn/apm-synthtrace-client';
import { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace';
import { APIReturnType } from '@kbn/apm-plugin/public/services/rest/create_call_apm_api';
import { ENVIRONMENT_ALL } from '@kbn/apm-plugin/common/environment_filter_values';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { generateMobileData } from './generate_mobile_data';
type MobileLocationStats =
APIReturnType<'GET /internal/apm/mobile-services/{serviceName}/location/stats'>;
// we generate 3 transactions per each mobile device
// timerange 15min, interval 5m, rate 1
// generate 3 http spans for galaxy10 device
async function generateData({
start,
end,
synthtraceEsClient,
}: {
start: number;
end: number;
synthtraceEsClient: ApmSynthtraceEsClient;
}) {
const galaxy10 = apm
.mobileApp({
name: 'synth-android',
environment: 'production',
agentName: 'android/java',
})
.mobileDevice({ serviceVersion: '1.1' })
.deviceInfo({
manufacturer: 'Samsung',
modelIdentifier: 'SM-G973F',
modelName: 'Galaxy S10',
})
.osInfo({
osType: 'android',
osVersion: '10',
osFull: 'Android 10, API level 29, BUILD A022MUBU2AUD1',
runtimeVersion: '2.1.0',
})
.setGeoInfo({
clientIp: '223.72.43.22',
cityName: 'Beijing',
continentName: 'Asia',
countryIsoCode: 'CN',
countryName: 'China',
regionIsoCode: 'CN-BJ',
regionName: 'Beijing',
location: { coordinates: [116.3861, 39.9143], type: 'Point' },
})
.setNetworkConnection({ type: 'wifi' });
const galaxy7 = apm
.mobileApp({
name: 'synth-android',
environment: 'production',
agentName: 'android/java',
})
.mobileDevice({ serviceVersion: '1.2' })
.deviceInfo({
manufacturer: 'Samsung',
modelIdentifier: 'SM-G930F',
modelName: 'Galaxy S7',
})
.osInfo({
osType: 'android',
osVersion: '10',
osFull: 'Android 10, API level 29, BUILD A022MUBU2AUD1',
runtimeVersion: '2.1.0',
})
.setGeoInfo({
clientIp: '223.72.43.22',
cityName: 'Beijing',
continentName: 'Asia',
countryIsoCode: 'CN',
countryName: 'China',
regionIsoCode: 'CN-BJ',
regionName: 'Beijing',
location: { coordinates: [116.3861, 39.9143], type: 'Point' },
})
.setNetworkConnection({
type: 'cell',
subType: 'edge',
carrierName: 'M1 Limited',
carrierMNC: '03',
carrierICC: 'SG',
carrierMCC: '525',
});
const huaweiP2 = apm
.mobileApp({
name: 'synth-android',
environment: 'production',
agentName: 'android/java',
})
.mobileDevice({ serviceVersion: '2.3' })
.deviceInfo({
manufacturer: 'Huawei',
modelIdentifier: 'HUAWEI P2-0000',
modelName: 'HuaweiP2',
})
.osInfo({
osType: 'android',
osVersion: '11',
osFull: 'Android 10, API level 29, BUILD A022MUBU2AUD1',
runtimeVersion: '2.1.0',
})
.setGeoInfo({
clientIp: '20.24.184.101',
cityName: 'Singapore',
continentName: 'Asia',
countryIsoCode: 'SG',
countryName: 'Singapore',
location: { coordinates: [103.8554, 1.3036], type: 'Point' },
})
.setNetworkConnection({
type: 'cell',
subType: 'edge',
carrierName: 'Osaka Gas Business Create Co., Ltd.',
carrierMNC: '17',
carrierICC: 'JP',
carrierMCC: '440',
});
return await synthtraceEsClient.index([
timerange(start, end)
.interval('5m')
.rate(1)
.generator((timestamp) => {
galaxy10.startNewSession();
galaxy7.startNewSession();
huaweiP2.startNewSession();
return [
galaxy10
.transaction('Start View - View Appearing', 'Android Activity')
.errors(galaxy10.crash({ message: 'error' }).timestamp(timestamp))
.timestamp(timestamp)
.duration(500)
.success()
.children(
galaxy10
.httpSpan({
spanName: 'GET backend:1234',
httpMethod: 'GET',
httpUrl: 'https://backend:1234/api/start',
})
.duration(800)
.success()
.timestamp(timestamp + 400)
),
galaxy7
.transaction('Start View - View Appearing', 'Android Activity')
.errors(galaxy7.crash({ message: 'error' }).timestamp(timestamp))
.timestamp(timestamp)
.duration(20)
.success(),
huaweiP2
.transaction('Start View - View Appearing', 'huaweiP2 Activity')
.errors(huaweiP2.crash({ message: 'error' }).timestamp(timestamp))
.timestamp(timestamp)
.duration(20)
.success(),
];
}),
]);
}
export default function ApiTest({ getService }: FtrProviderContext) {
const apmApiClient = getService('apmApiClient');
const registry = getService('registry');
@ -66,7 +225,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
registry.when('Location stats', { config: 'basic', archives: [] }, () => {
before(async () => {
await generateMobileData({
await generateData({
synthtraceEsClient,
start,
end,
@ -96,9 +255,8 @@ export default function ApiTest({ getService }: FtrProviderContext) {
});
});
// FAILING: https://github.com/elastic/kibana/issues/156207
describe.skip('when filters are applied', () => {
it('returns empty state for filters', async () => {
describe('when filters are applied', () => {
it('returns empty state for filters with no results', async () => {
const response = await getMobileLocationStats({
serviceName: 'synth-android',
environment: 'production',
@ -120,21 +278,21 @@ export default function ApiTest({ getService }: FtrProviderContext) {
const response = await getMobileLocationStats({
serviceName: 'synth-android',
environment: 'production',
kuery: `service.version:"2.3"`,
kuery: `service.version:"1.1"`,
});
expect(response.currentPeriod.mostSessions.value).to.eql(12);
expect(response.currentPeriod.mostRequests.value).to.eql(0);
expect(response.currentPeriod.mostSessions.value).to.eql(3);
expect(response.currentPeriod.mostRequests.value).to.eql(3);
});
it('returns the correct values when multiple filters are applied', async () => {
const response = await getMobileLocationStats({
serviceName: 'synth-android',
kuery: `service.version:"2.3" and service.environment: "production"`,
kuery: `service.version:"1.1" and service.environment: "production"`,
});
expect(response.currentPeriod.mostSessions.value).to.eql(12);
expect(response.currentPeriod.mostRequests.value).to.eql(0);
expect(response.currentPeriod.mostSessions.value).to.eql(3);
expect(response.currentPeriod.mostRequests.value).to.eql(3);
});
});
});

View file

@ -6,9 +6,125 @@
*/
import expect from '@kbn/expect';
import { apm, timerange } from '@kbn/apm-synthtrace-client';
import { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace';
import { ENVIRONMENT_ALL } from '@kbn/apm-plugin/common/environment_filter_values';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { generateMobileData } from './generate_mobile_data';
const GALAXY_DURATION = 500;
const HUAWEI_DURATION = 20;
const TRANSACTIONS_COUNT = 3;
const SERVICE_VERSIONS = ['1.0', '2.0'];
const OS_VERSIONS = ['10', '11'];
// we generate 3 transactions per each mobile device
// timerange 15min, interval 5m, rate 1
function calculateLatency(duration: number) {
return ((duration * TRANSACTIONS_COUNT) / TRANSACTIONS_COUNT) * 1000; // convert to microseconds
}
function calculateThroughput({ start, end }: { start: number; end: number }) {
const durationAsMinutes = (end - start) / 1000 / 60;
return TRANSACTIONS_COUNT / durationAsMinutes;
}
async function generateData({
start,
end,
synthtraceEsClient,
}: {
start: number;
end: number;
synthtraceEsClient: ApmSynthtraceEsClient;
}) {
const galaxy10 = apm
.mobileApp({
name: 'synth-android',
environment: 'production',
agentName: 'android/java',
})
.mobileDevice({ serviceVersion: SERVICE_VERSIONS[0] })
.deviceInfo({
manufacturer: 'Samsung',
modelIdentifier: 'SM-G973F',
modelName: 'Galaxy S10',
})
.osInfo({
osType: 'android',
osVersion: OS_VERSIONS[0],
osFull: 'Android 10, API level 29, BUILD A022MUBU2AUD1',
runtimeVersion: '2.1.0',
})
.setGeoInfo({
clientIp: '223.72.43.22',
cityName: 'Beijing',
continentName: 'Asia',
countryIsoCode: 'CN',
countryName: 'China',
regionIsoCode: 'CN-BJ',
regionName: 'Beijing',
location: { coordinates: [116.3861, 39.9143], type: 'Point' },
})
.setNetworkConnection({ type: 'wifi' });
const huaweiP2 = apm
.mobileApp({
name: 'synth-android',
environment: 'production',
agentName: 'android/java',
})
.mobileDevice({ serviceVersion: SERVICE_VERSIONS[1] })
.deviceInfo({
manufacturer: 'Huawei',
modelIdentifier: 'HUAWEI P2-0000',
modelName: 'HuaweiP2',
})
.osInfo({
osType: 'android',
osVersion: OS_VERSIONS[1],
osFull: 'Android 10, API level 29, BUILD A022MUBU2AUD1',
runtimeVersion: '2.1.0',
})
.setGeoInfo({
clientIp: '20.24.184.101',
cityName: 'Singapore',
continentName: 'Asia',
countryIsoCode: 'SG',
countryName: 'Singapore',
location: { coordinates: [103.8554, 1.3036], type: 'Point' },
})
.setNetworkConnection({
type: 'cell',
subType: 'edge',
carrierName: 'Osaka Gas Business Create Co., Ltd.',
carrierMNC: '17',
carrierICC: 'JP',
carrierMCC: '440',
});
return await synthtraceEsClient.index([
timerange(start, end)
.interval('5m')
.rate(1)
.generator((timestamp) => {
galaxy10.startNewSession();
huaweiP2.startNewSession();
return [
galaxy10
.transaction('Start View - View Appearing', 'Android Activity')
.errors(galaxy10.crash({ message: 'error' }).timestamp(timestamp))
.timestamp(timestamp)
.duration(500)
.success(),
huaweiP2
.transaction('Start View - View Appearing', 'huaweiP2 Activity')
.errors(huaweiP2.crash({ message: 'error' }).timestamp(timestamp))
.timestamp(timestamp)
.duration(20)
.success(),
];
}),
]);
}
export default function ApiTest({ getService }: FtrProviderContext) {
const apmApiClient = getService('apmApiClient');
@ -64,7 +180,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
registry.when('Mobile main statistics', { config: 'basic', archives: [] }, () => {
before(async () => {
await generateMobileData({
await generateData({
synthtraceEsClient,
start,
end,
@ -74,6 +190,11 @@ export default function ApiTest({ getService }: FtrProviderContext) {
after(() => synthtraceEsClient.clean());
describe('when data is loaded', () => {
const huaweiLatency = calculateLatency(HUAWEI_DURATION);
const galaxyLatency = calculateLatency(GALAXY_DURATION);
const huaweiThroughput = calculateThroughput({ start, end });
const galaxyThroughput = calculateThroughput({ start, end });
it('returns the correct data for App version', async () => {
const response = await getMobileMainStatisticsByField({
serviceName: 'synth-android',
@ -82,16 +203,14 @@ export default function ApiTest({ getService }: FtrProviderContext) {
});
const fieldValues = response.mainStatistics.map((item) => item.name);
expect(fieldValues).to.be.eql(['1.1', '1.2', '2.3']);
expect(fieldValues).to.be.eql(SERVICE_VERSIONS);
const latencyValues = response.mainStatistics.map((item) => item.latency);
expect(latencyValues).to.be.eql([172000, 20000, 20000]);
expect(latencyValues).to.be.eql([galaxyLatency, huaweiLatency]);
const throughputValues = response.mainStatistics.map((item) => item.throughput);
expect(throughputValues).to.be.eql([
1.0000011111123457, 0.20000022222246913, 0.20000022222246913,
]);
expect(throughputValues).to.be.eql([galaxyThroughput, huaweiThroughput]);
});
it('returns the correct data for Os version', async () => {
const response = await getMobileMainStatisticsByField({
@ -102,14 +221,14 @@ export default function ApiTest({ getService }: FtrProviderContext) {
const fieldValues = response.mainStatistics.map((item) => item.name);
expect(fieldValues).to.be.eql(['10']);
expect(fieldValues).to.be.eql(OS_VERSIONS);
const latencyValues = response.mainStatistics.map((item) => item.latency);
expect(latencyValues).to.be.eql([128571.42857142857]);
expect(latencyValues).to.be.eql([galaxyLatency, huaweiLatency]);
const throughputValues = response.mainStatistics.map((item) => item.throughput);
expect(throughputValues).to.be.eql([1.4000015555572838]);
expect(throughputValues).to.be.eql([galaxyThroughput, huaweiThroughput]);
});
it('returns the correct data for Devices', async () => {
const response = await getMobileMainStatisticsByField({
@ -119,24 +238,14 @@ export default function ApiTest({ getService }: FtrProviderContext) {
});
const fieldValues = response.mainStatistics.map((item) => item.name);
expect(fieldValues).to.be.eql([
'HUAWEI P2-0000',
'SM-G930F',
'SM-G973F',
'Pixel 7 Pro',
'Pixel 8',
'SM-G930F',
]);
expect(fieldValues).to.be.eql(['HUAWEI P2-0000', 'SM-G973F']);
const latencyValues = response.mainStatistics.map((item) => item.latency);
expect(latencyValues).to.be.eql([400000, 20000, 20000, 20000, 20000, 20000]);
expect(latencyValues).to.be.eql([huaweiLatency, galaxyLatency]);
const throughputValues = response.mainStatistics.map((item) => item.throughput);
expect(throughputValues).to.be.eql([
0.40000044444493826, 0.20000022222246913, 0.20000022222246913, 0.20000022222246913,
0.20000022222246913, 0.20000022222246913,
]);
expect(throughputValues).to.be.eql([huaweiThroughput, galaxyThroughput]);
});
});
});

View file

@ -6,14 +6,129 @@
*/
import expect from '@kbn/expect';
import { apm, timerange } from '@kbn/apm-synthtrace-client';
import { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace';
import { APIReturnType } from '@kbn/apm-plugin/public/services/rest/create_call_apm_api';
import { ENVIRONMENT_ALL } from '@kbn/apm-plugin/common/environment_filter_values';
import { sumBy } from 'lodash';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { generateMobileData } from './generate_mobile_data';
type MobileStats = APIReturnType<'GET /internal/apm/mobile-services/{serviceName}/stats'>;
// we generate 3 transactions per each mobile device
// timerange 15min, interval 5m, rate 1
// generate 3 http spans for galaxy10 device
async function generateData({
start,
end,
synthtraceEsClient,
}: {
start: number;
end: number;
synthtraceEsClient: ApmSynthtraceEsClient;
}) {
const galaxy10 = apm
.mobileApp({
name: 'synth-android',
environment: 'production',
agentName: 'android/java',
})
.mobileDevice({ serviceVersion: '1.2' })
.deviceInfo({
manufacturer: 'Samsung',
modelIdentifier: 'SM-G973F',
modelName: 'Galaxy S10',
})
.osInfo({
osType: 'android',
osVersion: '10',
osFull: 'Android 10, API level 29, BUILD A022MUBU2AUD1',
runtimeVersion: '2.1.0',
})
.setGeoInfo({
clientIp: '223.72.43.22',
cityName: 'Beijing',
continentName: 'Asia',
countryIsoCode: 'CN',
countryName: 'China',
regionIsoCode: 'CN-BJ',
regionName: 'Beijing',
location: { coordinates: [116.3861, 39.9143], type: 'Point' },
})
.setNetworkConnection({ type: 'wifi' });
const huaweiP2 = apm
.mobileApp({
name: 'synth-android',
environment: 'production',
agentName: 'android/java',
})
.mobileDevice({ serviceVersion: '2.3' })
.deviceInfo({
manufacturer: 'Huawei',
modelIdentifier: 'HUAWEI P2-0000',
modelName: 'HuaweiP2',
})
.osInfo({
osType: 'android',
osVersion: '11',
osFull: 'Android 10, API level 29, BUILD A022MUBU2AUD1',
runtimeVersion: '2.1.0',
})
.setGeoInfo({
clientIp: '20.24.184.101',
cityName: 'Singapore',
continentName: 'Asia',
countryIsoCode: 'SG',
countryName: 'Singapore',
location: { coordinates: [103.8554, 1.3036], type: 'Point' },
})
.setNetworkConnection({
type: 'cell',
subType: 'edge',
carrierName: 'Osaka Gas Business Create Co., Ltd.',
carrierMNC: '17',
carrierICC: 'JP',
carrierMCC: '440',
});
return await synthtraceEsClient.index([
timerange(start, end)
.interval('5m')
.rate(1)
.generator((timestamp) => {
galaxy10.startNewSession();
huaweiP2.startNewSession();
return [
galaxy10
.transaction('Start View - View Appearing', 'Android Activity')
.errors(galaxy10.crash({ message: 'error' }).timestamp(timestamp))
.timestamp(timestamp)
.duration(500)
.success()
.children(
galaxy10
.httpSpan({
spanName: 'GET backend:1234',
httpMethod: 'GET',
httpUrl: 'https://backend:1234/api/start',
})
.duration(800)
.success()
.timestamp(timestamp + 400)
),
huaweiP2
.transaction('Start View - View Appearing', 'huaweiP2 Activity')
.errors(huaweiP2.crash({ message: 'error' }).timestamp(timestamp))
.timestamp(timestamp)
.duration(20)
.success(),
];
}),
]);
}
export default function ApiTest({ getService }: FtrProviderContext) {
const apmApiClient = getService('apmApiClient');
const registry = getService('registry');
@ -66,7 +181,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
registry.when('Mobile stats', { config: 'basic', archives: [] }, () => {
before(async () => {
await generateMobileData({
await generateData({
synthtraceEsClient,
start,
end,
@ -98,8 +213,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
});
});
// FAILING: https://github.com/elastic/kibana/issues/156218
describe.skip('when filters are applied', () => {
describe('when filters are applied', () => {
it('returns empty state for filters', async () => {
const response = await getMobileStats({
serviceName: 'synth-android',
@ -122,7 +236,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
const response = await getMobileStats({
serviceName: 'synth-android',
environment: 'production',
kuery: `service.version:"1.2"`,
kuery: `service.version:"2.3"`,
});
expect(response.currentPeriod.sessions.value).to.eql(3);
@ -132,11 +246,11 @@ export default function ApiTest({ getService }: FtrProviderContext) {
it('returns the correct values when multiple filters are applied', async () => {
const response = await getMobileStats({
serviceName: 'synth-android',
kuery: `service.version:"2.3" and service.environment: "production"`,
kuery: `service.version:"1.2" and service.environment: "production"`,
});
expect(response.currentPeriod.sessions.value).to.eql(12);
expect(response.currentPeriod.requests.value).to.eql(0);
expect(response.currentPeriod.sessions.value).to.eql(3);
expect(response.currentPeriod.requests.value).to.eql(3);
});
});
});

View file

@ -6,9 +6,123 @@
*/
import expect from '@kbn/expect';
import { apm, timerange } from '@kbn/apm-synthtrace-client';
import { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace';
import { ENVIRONMENT_ALL } from '@kbn/apm-plugin/common/environment_filter_values';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { generateMobileData } from './generate_mobile_data';
// we generate 3 transactions per each mobile device
// timerange 15min, interval 5m, rate 1
// generate 3 http spans for galaxy10 device
async function generateData({
start,
end,
synthtraceEsClient,
}: {
start: number;
end: number;
synthtraceEsClient: ApmSynthtraceEsClient;
}) {
const galaxy10 = apm
.mobileApp({
name: 'synth-android',
environment: 'production',
agentName: 'android/java',
})
.mobileDevice({ serviceVersion: '1.2' })
.deviceInfo({
manufacturer: 'Samsung',
modelIdentifier: 'SM-G973F',
modelName: 'Galaxy S10',
})
.osInfo({
osType: 'android',
osVersion: '10',
osFull: 'Android 10, API level 29, BUILD A022MUBU2AUD1',
runtimeVersion: '2.1.0',
})
.setGeoInfo({
clientIp: '223.72.43.22',
cityName: 'Beijing',
continentName: 'Asia',
countryIsoCode: 'CN',
countryName: 'China',
regionIsoCode: 'CN-BJ',
regionName: 'Beijing',
location: { coordinates: [116.3861, 39.9143], type: 'Point' },
})
.setNetworkConnection({ type: 'wifi' });
const huaweiP2 = apm
.mobileApp({
name: 'synth-android',
environment: 'production',
agentName: 'android/java',
})
.mobileDevice({ serviceVersion: '2.3' })
.deviceInfo({
manufacturer: 'Huawei',
modelIdentifier: 'HUAWEI P2-0000',
modelName: 'HuaweiP2',
})
.osInfo({
osType: 'android',
osVersion: '11',
osFull: 'Android 10, API level 29, BUILD A022MUBU2AUD1',
runtimeVersion: '2.1.0',
})
.setGeoInfo({
clientIp: '20.24.184.101',
cityName: 'Singapore',
continentName: 'Asia',
countryIsoCode: 'SG',
countryName: 'Singapore',
location: { coordinates: [103.8554, 1.3036], type: 'Point' },
})
.setNetworkConnection({
type: 'cell',
subType: 'edge',
carrierName: 'Osaka Gas Business Create Co., Ltd.',
carrierMNC: '17',
carrierICC: 'JP',
carrierMCC: '440',
});
return await synthtraceEsClient.index([
timerange(start, end)
.interval('5m')
.rate(1)
.generator((timestamp) => {
galaxy10.startNewSession();
huaweiP2.startNewSession();
return [
galaxy10
.transaction('Start View - View Appearing', 'Android Activity')
.errors(galaxy10.crash({ message: 'error' }).timestamp(timestamp))
.timestamp(timestamp)
.duration(500)
.success()
.children(
galaxy10
.httpSpan({
spanName: 'GET backend:1234',
httpMethod: 'GET',
httpUrl: 'https://backend:1234/api/start',
})
.duration(800)
.success()
.timestamp(timestamp + 400)
),
huaweiP2
.transaction('Start View - View Appearing', 'huaweiP2 Activity')
.errors(huaweiP2.crash({ message: 'error' }).timestamp(timestamp))
.timestamp(timestamp)
.duration(20)
.success(),
];
}),
]);
}
export default function ApiTest({ getService }: FtrProviderContext) {
const apmApiClient = getService('apmApiClient');
@ -73,7 +187,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
registry.when('Mobile terms', { config: 'basic', archives: [] }, () => {
before(async () => {
await generateMobileData({
await generateData({
synthtraceEsClient,
start,
end,
@ -91,12 +205,8 @@ export default function ApiTest({ getService }: FtrProviderContext) {
size: 10,
});
expect(response.terms).to.eql([
{ label: 'SM-G973F', count: 6 },
{ label: 'HUAWEI P2-0000', count: 3 },
{ label: 'Pixel 7', count: 3 },
{ label: 'Pixel 7 Pro', count: 3 },
{ label: 'Pixel 8', count: 3 },
{ label: 'SM-G930F', count: 3 },
{ label: 'SM-G973F', count: 3 },
]);
});
@ -109,15 +219,11 @@ export default function ApiTest({ getService }: FtrProviderContext) {
});
expect(response.terms).to.eql([
{
label: '2.3',
count: 15,
},
{
label: '1.1',
label: '1.2',
count: 3,
},
{
label: '1.2',
label: '2.3',
count: 3,
},
]);
@ -132,8 +238,8 @@ export default function ApiTest({ getService }: FtrProviderContext) {
});
expect(response.terms).to.eql([
{
label: '2.3',
count: 15,
label: '1.2',
count: 3,
},
]);
});