Skip to content

Commit

Permalink
[8.x] [Entity Analytics] Allow task status to be "claiming"…
Browse files Browse the repository at this point in the history
… in disable/enable test (#196172) (#196454)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Entity Analytics] Allow task status to be "claiming" in
disable/enable test
(#196172)](#196172)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Mark
Hopkin","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-15T22:27:50Z","message":"[Entity
Analytics] Allow task status to be \"claiming\" in disable/enable test
(#196172)\n\n## Summary\r\n\r\nCloses
#196166 \r\n\r\nThe test is
checking that when we disable the risk engine, the risk\r\newngine task
is registered but not actively running.\r\n\r\nThis check originally
checked if the task status was \"idle\".\r\n\r\nWe have had a failure
where the task status is \"claiming\", reading the\r\ndocs about this
task status (below) this is also an acceptable\r\n\"non-running\"
status\r\n\r\n```\r\n // idle: Task Instance isn't being worked on\r\n
// claiming: A Kibana instance has claimed ownership but hasn't started
running\r\n // the Task Instance
yet\r\n```","sha":"40bfd12cc55ebfb1641ef21133fb009c23b0106f","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:
SecuritySolution","backport:prev-minor","Team:Entity
Analytics"],"title":"[Entity Analytics] Allow task status to be
\"claiming\" in disable/enable
test","number":196172,"url":"https://github.com/elastic/kibana/pull/196172","mergeCommit":{"message":"[Entity
Analytics] Allow task status to be \"claiming\" in disable/enable test
(#196172)\n\n## Summary\r\n\r\nCloses
#196166 \r\n\r\nThe test is
checking that when we disable the risk engine, the risk\r\newngine task
is registered but not actively running.\r\n\r\nThis check originally
checked if the task status was \"idle\".\r\n\r\nWe have had a failure
where the task status is \"claiming\", reading the\r\ndocs about this
task status (below) this is also an acceptable\r\n\"non-running\"
status\r\n\r\n```\r\n // idle: Task Instance isn't being worked on\r\n
// claiming: A Kibana instance has claimed ownership but hasn't started
running\r\n // the Task Instance
yet\r\n```","sha":"40bfd12cc55ebfb1641ef21133fb009c23b0106f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196172","number":196172,"mergeCommit":{"message":"[Entity
Analytics] Allow task status to be \"claiming\" in disable/enable test
(#196172)\n\n## Summary\r\n\r\nCloses
#196166 \r\n\r\nThe test is
checking that when we disable the risk engine, the risk\r\newngine task
is registered but not actively running.\r\n\r\nThis check originally
checked if the task status was \"idle\".\r\n\r\nWe have had a failure
where the task status is \"claiming\", reading the\r\ndocs about this
task status (below) this is also an acceptable\r\n\"non-running\"
status\r\n\r\n```\r\n // idle: Task Instance isn't being worked on\r\n
// claiming: A Kibana instance has claimed ownership but hasn't started
running\r\n // the Task Instance
yet\r\n```","sha":"40bfd12cc55ebfb1641ef21133fb009c23b0106f"}}]}]
BACKPORT-->

Co-authored-by: Mark Hopkin <[email protected]>
  • Loading branch information
kibanamachine and hop-dev authored Oct 16, 2024
1 parent 735edb1 commit b8fcdcc
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 b8fcdcc

Please sign in to comment.