-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding api test for transaction_groups /breakdown and /avg_duration_b…
…y_browser
- Loading branch information
1 parent
c5073f4
commit 103f722
Showing
8 changed files
with
1,094 additions
and
11 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
43 changes: 43 additions & 0 deletions
43
x-pack/test/apm_api_integration/basic/tests/transaction_groups/avg_duration_by_browser.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,43 @@ | ||
/* | ||
* 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 expectedAvgDurationByBrowser from './expectation/avg_duration_by_browser.json'; | ||
|
||
export default function ApiTest({ getService }: FtrProviderContext) { | ||
const supertest = getService('supertest'); | ||
const esArchiver = getService('esArchiver'); | ||
|
||
const start = encodeURIComponent('2020-06-29T06:45:00.000Z'); | ||
const end = encodeURIComponent('2020-06-29T06:49:00.000Z'); | ||
const uiFilters = encodeURIComponent(JSON.stringify({})); | ||
|
||
describe('Average duration by browser', () => { | ||
describe('when data is not loaded', () => { | ||
it('handles the empty state', async () => { | ||
const response = await supertest.get( | ||
`/api/apm/services/client/transaction_groups/avg_duration_by_browser?start=${start}&end=${end}&uiFilters=${uiFilters}` | ||
); | ||
expect(response.status).to.be(200); | ||
expect(response.body).to.eql([]); | ||
}); | ||
}); | ||
|
||
describe('when data is loaded', () => { | ||
before(() => esArchiver.load('8.0.0')); | ||
after(() => esArchiver.unload('8.0.0')); | ||
|
||
it('returns the average duration by browser', async () => { | ||
const response = await supertest.get( | ||
`/api/apm/services/client/transaction_groups/avg_duration_by_browser?start=${start}&end=${end}&uiFilters=${uiFilters}` | ||
); | ||
|
||
expect(response.status).to.be(200); | ||
expect(response.body).to.eql(expectedAvgDurationByBrowser); | ||
}); | ||
}); | ||
}); | ||
} |
54 changes: 54 additions & 0 deletions
54
x-pack/test/apm_api_integration/basic/tests/transaction_groups/breakdown.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,54 @@ | ||
/* | ||
* 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 expectedBreakdown from './expectation/breakdown.json'; | ||
import expectedBreakdownWithTransactionName from './expectation/breakdown_transaction_name.json'; | ||
|
||
export default function ApiTest({ getService }: FtrProviderContext) { | ||
const supertest = getService('supertest'); | ||
const esArchiver = getService('esArchiver'); | ||
|
||
const start = encodeURIComponent('2020-06-29T06:45:00.000Z'); | ||
const end = encodeURIComponent('2020-06-29T06:49:00.000Z'); | ||
const transactionType = 'request'; | ||
const transactionName = 'GET /api'; | ||
const uiFilters = encodeURIComponent(JSON.stringify({})); | ||
|
||
describe('Breakdown', () => { | ||
describe('when data is not loaded', () => { | ||
it('handles the empty state', async () => { | ||
const response = await supertest.get( | ||
`/api/apm/services/opbeans-node/transaction_groups/breakdown?start=${start}&end=${end}&uiFilters=${uiFilters}&transactionType=${transactionType}` | ||
); | ||
expect(response.status).to.be(200); | ||
expect(response.body).to.eql({ kpis: [], timeseries: [] }); | ||
}); | ||
}); | ||
|
||
describe('when data is loaded', () => { | ||
before(() => esArchiver.load('8.0.0')); | ||
after(() => esArchiver.unload('8.0.0')); | ||
|
||
it('returns the transaction breakdown', async () => { | ||
const response = await supertest.get( | ||
`/api/apm/services/opbeans-node/transaction_groups/breakdown?start=${start}&end=${end}&uiFilters=${uiFilters}&transactionType=${transactionType}` | ||
); | ||
|
||
expect(response.status).to.be(200); | ||
expect(response.body).to.eql(expectedBreakdown); | ||
}); | ||
it('returns the transaction breakdown with transaction name', async () => { | ||
const response = await supertest.get( | ||
`/api/apm/services/opbeans-node/transaction_groups/breakdown?start=${start}&end=${end}&uiFilters=${uiFilters}&transactionType=${transactionType}&transactionName=${transactionName}` | ||
); | ||
|
||
expect(response.status).to.be(200); | ||
expect(response.body).to.eql(expectedBreakdownWithTransactionName); | ||
}); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.