From f0d06d84ec097decf2e1ec2a970da83068dd5fdc Mon Sep 17 00:00:00 2001 From: Aaron Caldwell Date: Wed, 17 Mar 2021 15:47:54 -0600 Subject: [PATCH] Show index fails to clobber existing index --- .../api_integration/apis/maps/create_doc_source.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/x-pack/test/api_integration/apis/maps/create_doc_source.js b/x-pack/test/api_integration/apis/maps/create_doc_source.js index 759862de4a0985..73d6668019df72 100644 --- a/x-pack/test/api_integration/apis/maps/create_doc_source.js +++ b/x-pack/test/api_integration/apis/maps/create_doc_source.js @@ -11,7 +11,7 @@ export default function ({ getService }) { const supertest = getService('supertest'); describe('doc source creation', () => { - it('should create an index and pattern', async () => { + it('should create a new index and pattern but not clobber an existing one', async () => { const resp = await supertest .post(`/api/maps/docSource`) .set('kbn-xsrf', 'kibana') @@ -22,6 +22,16 @@ export default function ({ getService }) { .expect(200); expect(resp.body.success).to.be(true); + + // Repeated index fails. We don't want the user clobbering indexes + await supertest + .post(`/api/maps/docSource`) + .set('kbn-xsrf', 'kibana') + .send({ + index: 'testing123', + mappings: { properties: { coordinates: { type: 'geo_point' } } }, + }) + .expect(500); }); it('should fail to create index and pattern with invalid index', async () => {