-
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.
[Search Profiler] Migrate server to new es-js client (#88725)
- Loading branch information
1 parent
4bc5f01
commit 43db7e3
Showing
4 changed files
with
80 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* 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 { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ loadTestFile }: FtrProviderContext) { | ||
describe('Search Profiler', () => { | ||
loadTestFile(require.resolve('./searchprofiler')); | ||
}); | ||
} |
56 changes: 56 additions & 0 deletions
56
x-pack/test/api_integration/apis/searchprofiler/searchprofiler.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,56 @@ | ||
/* | ||
* 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 '../../ftr_provider_context'; | ||
|
||
const API_BASE_PATH = '/api/searchprofiler'; | ||
|
||
export default function ({ getService }: FtrProviderContext) { | ||
const supertest = getService('supertest'); | ||
|
||
describe('Profile', () => { | ||
it('should return profile results for a valid index', async () => { | ||
const payload = { | ||
index: '_all', | ||
query: { | ||
query: { | ||
match_all: {}, | ||
}, | ||
}, | ||
}; | ||
|
||
const { body } = await supertest | ||
.post(`${API_BASE_PATH}/profile`) | ||
.set('kbn-xsrf', 'xxx') | ||
.set('Content-Type', 'application/json;charset=UTF-8') | ||
.send(payload) | ||
.expect(200); | ||
|
||
expect(body.ok).to.eql(true); | ||
}); | ||
|
||
it('should return error for invalid index', async () => { | ||
const payloadWithInvalidIndex = { | ||
index: 'index_does_not_exist', | ||
query: { | ||
query: { | ||
match_all: {}, | ||
}, | ||
}, | ||
}; | ||
|
||
const { body } = await supertest | ||
.post(`${API_BASE_PATH}/execute`) | ||
.set('kbn-xsrf', 'xxx') | ||
.set('Content-Type', 'application/json;charset=UTF-8') | ||
.send(payloadWithInvalidIndex) | ||
.expect(404); | ||
|
||
expect(body.error).to.eql('Not Found'); | ||
}); | ||
}); | ||
} |