Skip to content

Commit

Permalink
[Entity Analytics] Allow task status to be "claiming" in disable/enab…
Browse files Browse the repository at this point in the history
…le test (elastic#196172)

## Summary

Closes elastic#196166

The test is checking that when we disable the risk engine, the risk
ewngine task is registered but not actively running.

This check originally checked if the task status was "idle".

We have had a failure where the task status is "claiming", reading the
docs about this task status (below) this is also an acceptable
"non-running" status

```
  // idle: Task Instance isn't being worked on
  // claiming: A Kibana instance has claimed ownership but hasn't started running
  //           the Task Instance yet
```

(cherry picked from commit 40bfd12)
  • Loading branch information
hop-dev committed Oct 15, 2024
1 parent c54e6a9 commit 58a50af
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import {
} from '../../utils';
import { FtrProviderContext } from '../../../../ftr_provider_context';

const expectTaskIsNotRunning = (taskStatus?: string) => {
expect(['idle', 'claiming']).contain(taskStatus);
};

export default ({ getService }: FtrProviderContext) => {
const es = getService('es');
const supertest = getService('supertest');
Expand Down Expand Up @@ -356,7 +360,7 @@ export default ({ getService }: FtrProviderContext) => {
expect(status2.body.legacy_risk_engine_status).to.be('NOT_INSTALLED');

expect(status2.body.risk_engine_task_status?.runAt).to.be.a('string');
expect(status2.body.risk_engine_task_status?.status).to.be('idle');
expectTaskIsNotRunning(status2.body.risk_engine_task_status?.status);
expect(status2.body.risk_engine_task_status?.startedAt).to.be(undefined);

await riskEngineRoutes.disable();
Expand All @@ -374,7 +378,7 @@ export default ({ getService }: FtrProviderContext) => {
expect(status4.body.legacy_risk_engine_status).to.be('NOT_INSTALLED');

expect(status4.body.risk_engine_task_status?.runAt).to.be.a('string');
expect(status4.body.risk_engine_task_status?.status).to.be('idle');
expectTaskIsNotRunning(status4.body.risk_engine_task_status?.status);
expect(status4.body.risk_engine_task_status?.startedAt).to.be(undefined);
});

Expand All @@ -395,7 +399,7 @@ export default ({ getService }: FtrProviderContext) => {
expect(status2.body.legacy_risk_engine_status).to.be('NOT_INSTALLED');

expect(status2.body.risk_engine_task_status?.runAt).to.be.a('string');
expect(status2.body.risk_engine_task_status?.status).to.be('idle');
expectTaskIsNotRunning(status2.body.risk_engine_task_status?.status);
expect(status2.body.risk_engine_task_status?.startedAt).to.be(undefined);
});
});
Expand Down

0 comments on commit 58a50af

Please sign in to comment.