-
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.
Revert "Fix API integration tests by removing tests for deleted rollu…
…p search endpoint." This reverts commit 9e190e6.
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 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
53 changes: 53 additions & 0 deletions
53
x-pack/test/api_integration/apis/management/rollup/rollup_search.js
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,53 @@ | ||
/* | ||
* 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 { registerHelpers } from './rollup.test_helpers'; | ||
import { API_BASE_PATH } from './constants'; | ||
import { getRandomString } from './lib'; | ||
|
||
export default function({ getService }) { | ||
const supertest = getService('supertest'); | ||
const es = getService('legacyEs'); | ||
|
||
const { createIndexWithMappings, getJobPayload, createJob, cleanUp } = registerHelpers({ | ||
supertest, | ||
es, | ||
}); | ||
|
||
describe('search', () => { | ||
const URI = `${API_BASE_PATH}/search`; | ||
|
||
it('return a 404 if the rollup index does not exist', async () => { | ||
const { body } = await supertest | ||
.post(URI) | ||
.set('kbn-xsrf', 'xxx') | ||
.send([{ index: 'unknown', query: {} }]) | ||
.expect(404); | ||
|
||
expect(body.message).to.contain('no such index [unknown]'); | ||
}); | ||
|
||
it('should return a 200 when searching on existing rollup index', async () => { | ||
// Create a Rollup job on an index with the INDEX_TO_ROLLUP_MAPPINGS | ||
const indexName = await createIndexWithMappings(); | ||
const rollupIndex = getRandomString(); | ||
await createJob(getJobPayload(indexName, undefined, rollupIndex)); | ||
|
||
const { body } = await supertest | ||
.post(URI) | ||
.set('kbn-xsrf', 'xxx') | ||
.send([{ index: rollupIndex, query: { size: 0 } }]) | ||
.expect(200); | ||
|
||
// make sure total hits is an integer and not an object | ||
expect(body[0].hits.total).to.equal(0); | ||
|
||
await cleanUp(); | ||
}); | ||
}); | ||
} |