diff --git a/x-pack/test/api_integration/apis/search/session.ts b/x-pack/test/api_integration/apis/search/session.ts index 43eb9539b16eb..ad3504e756a09 100644 --- a/x-pack/test/api_integration/apis/search/session.ts +++ b/x-pack/test/api_integration/apis/search/session.ts @@ -292,119 +292,5 @@ export default function ({ getService }: FtrProviderContext) { getSessionSecondTime.body.attributes.touched ); }); - - it('should sync search ids into not persisted session', async () => { - const sessionId = `my-session-${Math.random()}`; - - // run search - const searchRes1 = await supertest - .post(`/internal/search/ese`) - .set('kbn-xsrf', 'foo') - .send({ - sessionId, - params: { - body: { - query: { - term: { - agent: '1', - }, - }, - }, - wait_for_completion_timeout: '1ms', - }, - }) - .expect(200); - - const { id: id1 } = searchRes1.body; - - // run search - const searchRes2 = await supertest - .post(`/internal/search/ese`) - .set('kbn-xsrf', 'foo') - .send({ - sessionId, - params: { - body: { - query: { - match_all: {}, - }, - }, - wait_for_completion_timeout: '1ms', - }, - }) - .expect(200); - - const { id: id2 } = searchRes2.body; - - const resp = await supertest - .get(`/internal/session/${sessionId}`) - .set('kbn-xsrf', 'foo') - .expect(200); - - const { appId, name, touched, created, persisted, idMapping } = resp.body.attributes; - expect(persisted).to.be(false); - expect(name).to.be(undefined); - expect(appId).to.be(undefined); - expect(touched).not.to.be(undefined); - expect(created).not.to.be(undefined); - - const idMappings = Object.values(idMapping).map((value: any) => value.id); - expect(idMappings).to.contain(id1); - expect(idMappings).to.contain(id2); - }); - - it('touched time updates when you poll on an search', async () => { - const sessionId = `my-session-${Math.random()}`; - - // run search - const searchRes1 = await supertest - .post(`/internal/search/ese`) - .set('kbn-xsrf', 'foo') - .send({ - sessionId, - params: { - body: { - query: { - term: { - agent: '1', - }, - }, - }, - wait_for_completion_timeout: '1ms', - }, - }) - .expect(200); - - const { id: id1 } = searchRes1.body; - - // it might take the session a moment to be created - await new Promise((resolve) => setTimeout(resolve, 1000)); - - const getSessionFirstTime = await supertest - .get(`/internal/session/${sessionId}`) - .set('kbn-xsrf', 'foo') - .expect(200); - - // poll on search - await supertest - .post(`/internal/search/ese/${id1}`) - .set('kbn-xsrf', 'foo') - .send({ - sessionId, - }) - .expect(200); - - const getSessionSecondTime = await supertest - .get(`/internal/session/${sessionId}`) - .set('kbn-xsrf', 'foo') - .expect(200); - - expect(getSessionFirstTime.body.attributes.sessionId).to.be.equal( - getSessionSecondTime.body.attributes.sessionId - ); - expect(getSessionFirstTime.body.attributes.touched).to.be.lessThan( - getSessionSecondTime.body.attributes.touched - ); - }); }); }