-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Testing error rate API and restructuring folders (#72257)
* adding error rate and restructuring tests * removing console log * removing console log * adding error rate and restructuring tests * fixing TS error * removing unnecessary files * removing trial tests
- Loading branch information
1 parent
4acdf27
commit 7976e2b
Showing
19 changed files
with
138 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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
File renamed without changes.
This file contains 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
47 changes: 47 additions & 0 deletions
47
x-pack/test/apm_api_integration/basic/tests/transaction_groups/error_rate.ts
This file contains 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,47 @@ | ||
/* | ||
* 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 '../../../common/ftr_provider_context'; | ||
import expectedErrorRate from './expectation/error_rate.json'; | ||
|
||
export default function ApiTest({ getService }: FtrProviderContext) { | ||
const supertest = getService('supertest'); | ||
const esArchiver = getService('esArchiver'); | ||
|
||
// url parameters | ||
const start = encodeURIComponent('2020-06-29T06:45:00.000Z'); | ||
const end = encodeURIComponent('2020-06-29T06:49:00.000Z'); | ||
const uiFilters = encodeURIComponent(JSON.stringify({})); | ||
|
||
describe('Error rate', () => { | ||
describe('when data is not loaded', () => { | ||
it('handles the empty state', async () => { | ||
const response = await supertest.get( | ||
`/api/apm/services/opbeans-node/transaction_groups/error_rate?start=${start}&end=${end}&uiFilters=${uiFilters}` | ||
); | ||
expect(response.status).to.be(200); | ||
expect(response.body).to.eql({ | ||
noHits: true, | ||
erroneousTransactionsRate: [], | ||
average: null, | ||
}); | ||
}); | ||
}); | ||
describe('when data is loaded', () => { | ||
before(() => esArchiver.load('8.0.0')); | ||
after(() => esArchiver.unload('8.0.0')); | ||
|
||
it('returns the transaction error rate', async () => { | ||
const response = await supertest.get( | ||
`/api/apm/services/opbeans-node/transaction_groups/error_rate?start=${start}&end=${end}&uiFilters=${uiFilters}` | ||
); | ||
|
||
expect(response.status).to.be(200); | ||
expect(response.body).to.eql(expectedErrorRate); | ||
}); | ||
}); | ||
}); | ||
} |
42 changes: 42 additions & 0 deletions
42
x-pack/test/apm_api_integration/basic/tests/transaction_groups/expectation/error_rate.json
This file contains 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,42 @@ | ||
{ | ||
"noHits":false, | ||
"erroneousTransactionsRate":[ | ||
{ | ||
"x":1593413100000, | ||
"y":null | ||
}, | ||
{ | ||
"x":1593413130000, | ||
"y":null | ||
}, | ||
{ | ||
"x":1593413160000, | ||
"y":null | ||
}, | ||
{ | ||
"x":1593413190000, | ||
"y":null | ||
}, | ||
{ | ||
"x":1593413220000, | ||
"y":null | ||
}, | ||
{ | ||
"x":1593413250000, | ||
"y":0 | ||
}, | ||
{ | ||
"x":1593413280000, | ||
"y":0.14102564102564102 | ||
}, | ||
{ | ||
"x":1593413310000, | ||
"y":0.14634146341463414 | ||
}, | ||
{ | ||
"x":1593413340000, | ||
"y":null | ||
} | ||
], | ||
"average":0.09578903481342504 | ||
} |
File renamed without changes.
File renamed without changes.
This file contains 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 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 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 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 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 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