Skip to content

Commit

Permalink
[Alerting] Fixing flaky tests (#111366)
Browse files Browse the repository at this point in the history
* Unskipping test

* Retrying deletes

* Unskipping test

* Changing fn signature

* hmm

* Removing unnecessary code

* Unskipping test

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
ymao1 and kibanamachine authored Sep 9, 2021
1 parent 36cec00 commit 334f129
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 23 deletions.
8 changes: 8 additions & 0 deletions x-pack/plugins/alerting/server/rules_client/rules_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,14 @@ export class RulesClient {
}

public async delete({ id }: { id: string }) {
return await retryIfConflicts(
this.logger,
`rulesClient.delete('${id}')`,
async () => await this.deleteWithOCC({ id })
);
}

private async deleteWithOCC({ id }: { id: string }) {
let taskIdToRemove: string | undefined | null;
let apiKeyToInvalidate: string | null = null;
let attributes: RawAlert;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ export default function alertTests({ getService }: FtrProviderContext) {
const esTestIndexTool = new ESTestIndexTool(es, retry);
const taskManagerUtils = new TaskManagerUtils(es, retry);

// FLAKY: https://github.com/elastic/kibana/issues/106492
describe.skip('alerts', () => {
describe('alerts', () => {
const authorizationIndex = '.kibana-test-authorization';
const objectRemover = new ObjectRemover(supertest);

Expand Down Expand Up @@ -502,19 +501,6 @@ instanceStateValue: true
})
);

// Enqueue non ephemerically so we the latter code can query properly
const enqueueResponse = await supertest
.post(`${getUrlPrefix(space.id)}/api/alerts_fixture/${createdAction.id}/enqueue_action`)
.set('kbn-xsrf', 'foo')
.send({
params: {
reference,
index: ES_TEST_INDEX_NAME,
retryAt: retryDate.getTime(),
},
});
expect(enqueueResponse.status).to.eql(204);

switch (scenario.id) {
case 'no_kibana_privileges at space1':
case 'global_read at space1':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export default function createDeleteTests({ getService }: FtrProviderContext) {
const retry = getService('retry');
const supertestWithoutAuth = getService('supertestWithoutAuth');

// FLAKY https://github.com/elastic/kibana/issues/111001
describe.skip('delete', () => {
describe('delete', () => {
const objectRemover = new ObjectRemover(supertest);

after(() => objectRemover.removeAll());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export default function createFindTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const supertestWithoutAuth = getService('supertestWithoutAuth');

// FLAKY https://github.com/elastic/kibana/issues/111022
describe.skip('find', () => {
describe('find', () => {
const objectRemover = new ObjectRemover(supertest);

afterEach(() => objectRemover.removeAll());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export default function createGetTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const supertestWithoutAuth = getService('supertestWithoutAuth');

// FLAKY https://github.com/elastic/kibana/issues/111496
describe.skip('get', () => {
describe('get', () => {
const objectRemover = new ObjectRemover(supertest);

afterEach(() => objectRemover.removeAll());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
.then((response: SupertestResponse) => response.body);
}

// FLAKY: https://github.com/elastic/kibana/issues/110801
describe.skip('update', () => {
describe('update', () => {
const objectRemover = new ObjectRemover(supertest);

after(() => objectRemover.removeAll());
Expand Down

0 comments on commit 334f129

Please sign in to comment.