mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
This PR adds functional API tests for the bucket span estimation endpoint with a transient or persistent `search.max_buckets` setting.
This commit is contained in:
parent
b77b127b10
commit
b5d4ca6ae4
1 changed files with 62 additions and 3 deletions
|
@ -64,6 +64,7 @@ const testDataList = [
|
|||
// eslint-disable-next-line import/no-default-export
|
||||
export default ({ getService }: FtrProviderContext) => {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const esSupertest = getService('esSupertest');
|
||||
const supertest = getService('supertest');
|
||||
|
||||
describe('bucket span estimator', () => {
|
||||
|
@ -75,8 +76,38 @@ export default ({ getService }: FtrProviderContext) => {
|
|||
await esArchiver.unload('ml/ecommerce');
|
||||
});
|
||||
|
||||
for (const testData of testDataList) {
|
||||
it(`estimates the bucket span ${testData.testTitleSuffix}`, async () => {
|
||||
describe('with default settings', function() {
|
||||
for (const testData of testDataList) {
|
||||
it(`estimates the bucket span ${testData.testTitleSuffix}`, async () => {
|
||||
const { body } = await supertest
|
||||
.post('/api/ml/validate/estimate_bucket_span')
|
||||
.set(COMMON_HEADERS)
|
||||
.send(testData.requestBody)
|
||||
.expect(testData.expected.responseCode);
|
||||
|
||||
expect(body).to.eql(testData.expected.responseBody);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('with transient search.max_buckets setting', function() {
|
||||
before(async () => {
|
||||
await esSupertest
|
||||
.put('/_cluster/settings')
|
||||
.send({ transient: { 'search.max_buckets': 9000 } })
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await esSupertest
|
||||
.put('/_cluster/settings')
|
||||
.send({ transient: { 'search.max_buckets': null } })
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
const testData = testDataList[0];
|
||||
|
||||
it(`estimates the bucket span`, async () => {
|
||||
const { body } = await supertest
|
||||
.post('/api/ml/validate/estimate_bucket_span')
|
||||
.set(COMMON_HEADERS)
|
||||
|
@ -85,6 +116,34 @@ export default ({ getService }: FtrProviderContext) => {
|
|||
|
||||
expect(body).to.eql(testData.expected.responseBody);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('with persistent search.max_buckets setting', function() {
|
||||
before(async () => {
|
||||
await esSupertest
|
||||
.put('/_cluster/settings')
|
||||
.send({ persistent: { 'search.max_buckets': 9000 } })
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await esSupertest
|
||||
.put('/_cluster/settings')
|
||||
.send({ persistent: { 'search.max_buckets': null } })
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
const testData = testDataList[0];
|
||||
|
||||
it(`estimates the bucket span`, async () => {
|
||||
const { body } = await supertest
|
||||
.post('/api/ml/validate/estimate_bucket_span')
|
||||
.set(COMMON_HEADERS)
|
||||
.send(testData.requestBody)
|
||||
.expect(testData.expected.responseCode);
|
||||
|
||||
expect(body).to.eql(testData.expected.responseBody);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue