diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/delete.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/delete.ts index fc453c8da72e7..f55b930a264c9 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/delete.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/delete.ts @@ -19,6 +19,7 @@ import { FtrProviderContext } from '../../../common/ftr_provider_context'; export default function createDeleteTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const es = getService('legacyEs'); + const retry = getService('retry'); const supertestWithoutAuth = getService('supertestWithoutAuth'); describe('delete', () => { @@ -301,17 +302,19 @@ export default function createDeleteTests({ getService }: FtrProviderContext) { .send(getTestAlertData()) .expect(200); - await supertest - .put( - `${getUrlPrefix(space.id)}/api/alerts_fixture/saved_object/alert/${createdAlert.id}` - ) - .set('kbn-xsrf', 'foo') - .send({ - attributes: { - name: 'bar', - }, - }) - .expect(200); + await retry.try(async () => { + await supertest + .put( + `${getUrlPrefix(space.id)}/api/alerts_fixture/saved_object/alert/${createdAlert.id}` + ) + .set('kbn-xsrf', 'foo') + .send({ + attributes: { + name: 'bar', + }, + }) + .expect(200); + }); const response = await supertestWithoutAuth .delete(`${getUrlPrefix(space.id)}/api/alerts/alert/${createdAlert.id}`) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/disable.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/disable.ts index 4e4f9053bd24f..03d8f77893802 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/disable.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/disable.ts @@ -20,6 +20,7 @@ import { // eslint-disable-next-line import/no-default-export export default function createDisableAlertTests({ getService }: FtrProviderContext) { const es = getService('legacyEs'); + const retry = getService('retry'); const supertest = getService('supertest'); const supertestWithoutAuth = getService('supertestWithoutAuth'); @@ -287,17 +288,19 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte .expect(200); objectRemover.add(space.id, createdAlert.id, 'alert', 'alerts'); - await supertest - .put( - `${getUrlPrefix(space.id)}/api/alerts_fixture/saved_object/alert/${createdAlert.id}` - ) - .set('kbn-xsrf', 'foo') - .send({ - attributes: { - name: 'bar', - }, - }) - .expect(200); + await retry.try(async () => { + await supertest + .put( + `${getUrlPrefix(space.id)}/api/alerts_fixture/saved_object/alert/${createdAlert.id}` + ) + .set('kbn-xsrf', 'foo') + .send({ + attributes: { + name: 'bar', + }, + }) + .expect(200); + }); const response = await alertUtils.getDisableRequest(createdAlert.id); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/enable.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/enable.ts index d7f6546bf34a9..2444f37ea5b20 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/enable.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/enable.ts @@ -20,6 +20,7 @@ import { // eslint-disable-next-line import/no-default-export export default function createEnableAlertTests({ getService }: FtrProviderContext) { const es = getService('legacyEs'); + const retry = getService('retry'); const supertest = getService('supertest'); const supertestWithoutAuth = getService('supertestWithoutAuth'); @@ -304,17 +305,19 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex .expect(200); objectRemover.add(space.id, createdAlert.id, 'alert', 'alerts'); - await supertest - .put( - `${getUrlPrefix(space.id)}/api/alerts_fixture/saved_object/alert/${createdAlert.id}` - ) - .set('kbn-xsrf', 'foo') - .send({ - attributes: { - name: 'bar', - }, - }) - .expect(200); + await retry.try(async () => { + await supertest + .put( + `${getUrlPrefix(space.id)}/api/alerts_fixture/saved_object/alert/${createdAlert.id}` + ) + .set('kbn-xsrf', 'foo') + .send({ + attributes: { + name: 'bar', + }, + }) + .expect(200); + }); const response = await alertUtils.getEnableRequest(createdAlert.id); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/event_log.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/event_log.ts index 459d214c8c993..564ab7b832dd3 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/event_log.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/event_log.ts @@ -37,16 +37,18 @@ export default function eventLogTests({ getService }: FtrProviderContext) { const alertId = response.body.id; objectRemover.add(spaceId, alertId, 'alert', 'alerts'); - // break AAD - await supertest - .put(`${getUrlPrefix(spaceId)}/api/alerts_fixture/saved_object/alert/${alertId}`) - .set('kbn-xsrf', 'foo') - .send({ - attributes: { - name: 'bar', - }, - }) - .expect(200); + await retry.try(async () => { + // break AAD + await supertest + .put(`${getUrlPrefix(spaceId)}/api/alerts_fixture/saved_object/alert/${alertId}`) + .set('kbn-xsrf', 'foo') + .send({ + attributes: { + name: 'bar', + }, + }) + .expect(200); + }); const events = await retry.try(async () => { // there can be a successful execute before the error one diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/execution_status.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/execution_status.ts index 4058b71356280..5295f5d90fb06 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/execution_status.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/execution_status.ts @@ -12,6 +12,7 @@ import { FtrProviderContext } from '../../../common/ftr_provider_context'; // eslint-disable-next-line import/no-default-export export default function executionStatusAlertTests({ getService }: FtrProviderContext) { + const retry = getService('retry'); const supertest = getService('supertest'); const spaceId = Spaces[0].id; @@ -37,16 +38,18 @@ export default function executionStatusAlertTests({ getService }: FtrProviderCon let executionStatus = await waitForStatus(alertId, new Set(['ok']), 10000); - // break AAD - await supertest - .put(`${getUrlPrefix(spaceId)}/api/alerts_fixture/saved_object/alert/${alertId}`) - .set('kbn-xsrf', 'foo') - .send({ - attributes: { - name: 'bar', - }, - }) - .expect(200); + await retry.try(async () => { + // break AAD + await supertest + .put(`${getUrlPrefix(spaceId)}/api/alerts_fixture/saved_object/alert/${alertId}`) + .set('kbn-xsrf', 'foo') + .send({ + attributes: { + name: 'bar', + }, + }) + .expect(200); + }); executionStatus = await waitForStatus(alertId, new Set(['error'])); expect(executionStatus.error).to.be.ok(); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts index 9c3d2801c0886..6b03492432acc 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts @@ -31,8 +31,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .then((response: SupertestResponse) => response.body); } - // FLAKY: https://github.com/elastic/kibana/issues/82804 - describe.skip('update', () => { + describe('update', () => { const objectRemover = new ObjectRemover(supertest); after(() => objectRemover.removeAll()); @@ -429,17 +428,19 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .expect(200); objectRemover.add(space.id, createdAlert.id, 'alert', 'alerts'); - await supertest - .put( - `${getUrlPrefix(space.id)}/api/alerts_fixture/saved_object/alert/${createdAlert.id}` - ) - .set('kbn-xsrf', 'foo') - .send({ - attributes: { - name: 'bar', - }, - }) - .expect(200); + await retry.try(async () => { + await supertest + .put( + `${getUrlPrefix(space.id)}/api/alerts_fixture/saved_object/alert/${createdAlert.id}` + ) + .set('kbn-xsrf', 'foo') + .send({ + attributes: { + name: 'bar', + }, + }) + .expect(200); + }); const updatedData = { name: 'bcd', diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update_api_key.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update_api_key.ts index 7dea591b895ee..0b525fbf7e809 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update_api_key.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update_api_key.ts @@ -19,6 +19,7 @@ import { // eslint-disable-next-line import/no-default-export export default function createUpdateApiKeyTests({ getService }: FtrProviderContext) { + const retry = getService('retry'); const supertest = getService('supertest'); const supertestWithoutAuth = getService('supertestWithoutAuth'); @@ -301,17 +302,19 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte .expect(200); objectRemover.add(space.id, createdAlert.id, 'alert', 'alerts'); - await supertest - .put( - `${getUrlPrefix(space.id)}/api/alerts_fixture/saved_object/alert/${createdAlert.id}` - ) - .set('kbn-xsrf', 'foo') - .send({ - attributes: { - name: 'bar', - }, - }) - .expect(200); + await retry.try(async () => { + await supertest + .put( + `${getUrlPrefix(space.id)}/api/alerts_fixture/saved_object/alert/${createdAlert.id}` + ) + .set('kbn-xsrf', 'foo') + .send({ + attributes: { + name: 'bar', + }, + }) + .expect(200); + }); const response = await alertUtils.getUpdateApiKeyRequest(createdAlert.id);