Skip to content

Commit

Permalink
[ML] APM Correlations: Fix API integration tests. (elastic#111532)
Browse files Browse the repository at this point in the history
A bugfix for significant terms on the ES side resulted in changes to assertions we have for api integration tests for APM correlations. This PR updates the affected tests.
  • Loading branch information
walterra authored and kibanamachine committed Sep 8, 2021
1 parent d39a53f commit c0db694
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
query: {
start: range.start,
end: range.end,
fieldNames: 'user_agent.name,user_agent.os.name,url.original',
fieldNames: 'http.response.status_code,user_agent.name,user_agent.os.name,url.original',
environment: 'ENVIRONMENT_ALL',
kuery: '',
},
Expand All @@ -40,8 +40,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
}
);

// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/109660
registry.when.skip(
registry.when(
'correlations errors failed transactions with data and default args',
{ config: 'trial', archives: ['apm_8.0.0'] },
() => {
Expand All @@ -66,8 +65,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
const sortedFieldNames = significantTerms.map(({ fieldName }) => fieldName).sort();
expectSnapshot(sortedFieldNames).toMatchInline(`
Array [
"user_agent.name",
"user_agent.name",
"http.response.status_code",
]
`);
});
Expand All @@ -77,7 +75,6 @@ export default function ApiTest({ getService }: FtrProviderContext) {
expectSnapshot(significantTerms.map((term) => term.timeseries.length)).toMatchInline(`
Array [
31,
31,
]
`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
};
};

registry.when('on trial license without data', { config: 'trial', archives: [] }, () => {
registry.when('failed transactions without data', { config: 'trial', archives: [] }, () => {
it('queries the search strategy and returns results', async () => {
const intialResponse = await supertest
.post(`/internal/bsearch`)
Expand Down Expand Up @@ -129,8 +129,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
});
});

// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/109703
registry.when.skip('on trial license with data', { config: 'trial', archives: ['8.0.0'] }, () => {
registry.when('failed transactions with data', { config: 'trial', archives: ['8.0.0'] }, () => {
it('queries the search strategy and returns results', async () => {
const intialResponse = await supertest
.post(`/internal/bsearch`)
Expand Down Expand Up @@ -215,26 +214,25 @@ export default function ApiTest({ getService }: FtrProviderContext) {
expect(finalRawResponse?.overallHistogram).to.be(undefined);

expect(finalRawResponse?.failedTransactionsCorrelations.length).to.eql(
43,
`Expected 43 identified correlations, got ${finalRawResponse?.failedTransactionsCorrelations.length}.`
30,
`Expected 30 identified correlations, got ${finalRawResponse?.failedTransactionsCorrelations.length}.`
);

expect(finalRawResponse?.log.map((d: string) => d.split(': ')[1])).to.eql([
'Identified 68 fieldCandidates.',
'Identified correlations for 68 fields out of 68 candidates.',
'Identified 43 significant correlations relating to failed transactions.',
'Identified 30 significant correlations relating to failed transactions.',
]);

const sortedCorrelations = finalRawResponse?.failedTransactionsCorrelations.sort();
const correlation = sortedCorrelations[0];

expect(typeof correlation).to.be('object');
expect(correlation?.key).to.be('HTTP 5xx');
expect(correlation?.doc_count).to.be(31);
expect(correlation?.score).to.be(100.17736139032642);
expect(correlation?.bg_count).to.be(60);
expect(correlation?.fieldName).to.be('transaction.result');
expect(correlation?.fieldValue).to.be('HTTP 5xx');
expect(correlation?.score).to.be(83.70467673605746);
expect(correlation?.bg_count).to.be(31);
expect(correlation?.fieldName).to.be('http.response.status_code');
expect(correlation?.fieldValue).to.be(500);
expect(typeof correlation?.pValue).to.be('number');
expect(typeof correlation?.normalizedScore).to.be('number');
expect(typeof correlation?.failurePercentage).to.be('number');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
}
);

// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/109583
registry.when.skip(
registry.when(
'correlations latency slow transactions with data and default args',
{ config: 'trial', archives: ['apm_8.0.0'] },
() => {
Expand Down Expand Up @@ -74,8 +73,6 @@ export default function ApiTest({ getService }: FtrProviderContext) {
"url.original",
"user_agent.name",
"user_agent.name",
"user_agent.name",
"user_agent.name",
"user_agent.os.name",
]
`);
Expand All @@ -91,8 +88,6 @@ export default function ApiTest({ getService }: FtrProviderContext) {
15,
15,
15,
15,
15,
]
`);
});
Expand Down

0 comments on commit c0db694

Please sign in to comment.