Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dosant committed Apr 14, 2021
1 parent f774a25 commit 2f0e451
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/api_integration/apis/search/bsearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default function ({ getService }: FtrProviderContext) {
});
});

it('should return 400 when unknown index type is provided', async () => {
it('should return 400 when index type is provided in "es" strategy', async () => {
const resp = await supertest.post(`/internal/bsearch`).send({
batch: [
{
Expand All @@ -130,14 +130,17 @@ export default function ({ getService }: FtrProviderContext) {
},
},
},
options: {
strategy: 'es',
},
},
],
});

expect(resp.status).to.be(200);
parseBfetchResponse(resp).forEach((responseJson, i) => {
expect(responseJson.id).to.be(i);
verifyErrorResponse(responseJson.error, 400, 'Unknown indexType');
verifyErrorResponse(responseJson.error, 400, 'Unsupported index pattern type baad');
});
});

Expand All @@ -151,20 +154,22 @@ export default function ({ getService }: FtrProviderContext) {
after(async () => {
await esArchiver.unload('../../../functional/fixtures/es_archiver/logstash_functional');
});
it('should return 400 for Painless error', async () => {
it('should return 400 "search_phase_execution_exception" for Painless error in "es" strategy', async () => {
const resp = await supertest.post(`/internal/bsearch`).send({
batch: [
{
request: painlessErrReq,
options: {
strategy: 'es',
},
},
],
});

expect(resp.status).to.be(200);
parseBfetchResponse(resp).forEach((responseJson, i) => {
expect(responseJson.id).to.be(i);
expect(responseJson.error.statusCode).to.be(400);
expect(responseJson.error.message).to.be('status_exception');
verifyErrorResponse(responseJson.error, 400, 'search_phase_execution_exception', true);
});
});
});
Expand Down

0 comments on commit 2f0e451

Please sign in to comment.