Skip to content

Commit

Permalink
[8.x] [Entity Analytics] Allow transfrom state to be "indexing&q…
Browse files Browse the repository at this point in the history
…uot; in risk engine test (elastic#193789) (elastic#193892)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Entity Analytics] Allow transfrom state to be "indexing"
in risk engine test
(elastic#193789)](elastic#193789)

<!--- 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-09-24T15:25:19Z","message":"[Entity
Analytics] Allow transfrom state to be \"indexing\" in risk engine test
(elastic#193789)\n\nCloses
https://github.com/elastic/kibana/issues/193709\r\n\r\nWe are testing
that the transform is successfully started, we have had a\r\ntest fail
because the transform is in state 'indexing' which is another\r\nhealthy
state indicating the transform is started and
healthy.","sha":"dcff2835310f3bfdb3e3c25f5dd4de0aa34deb6a","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 transfrom state to be
\"indexing\" in risk engine
test","number":193789,"url":"https://github.com/elastic/kibana/pull/193789","mergeCommit":{"message":"[Entity
Analytics] Allow transfrom state to be \"indexing\" in risk engine test
(elastic#193789)\n\nCloses
https://github.com/elastic/kibana/issues/193709\r\n\r\nWe are testing
that the transform is successfully started, we have had a\r\ntest fail
because the transform is in state 'indexing' which is another\r\nhealthy
state indicating the transform is started and
healthy.","sha":"dcff2835310f3bfdb3e3c25f5dd4de0aa34deb6a"}},"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/193789","number":193789,"mergeCommit":{"message":"[Entity
Analytics] Allow transfrom state to be \"indexing\" in risk engine test
(elastic#193789)\n\nCloses
https://github.com/elastic/kibana/issues/193709\r\n\r\nWe are testing
that the transform is successfully started, we have had a\r\ntest fail
because the transform is in state 'indexing' which is another\r\nhealthy
state indicating the transform is started and
healthy.","sha":"dcff2835310f3bfdb3e3c25f5dd4de0aa34deb6a"}}]}]
BACKPORT-->

Co-authored-by: Mark Hopkin <[email protected]>
  • Loading branch information
kibanamachine and hop-dev authored Sep 24, 2024
1 parent 7757bdb commit f39b04b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ export default ({ getService }: FtrProviderContext): void => {
});

it('@skipInServerlessMKI @skipInServerless starts the latest transform', async () => {
// Transform states that indicate the transform is running happily
const TRANSFORM_STARTED_STATES = ['started', 'indexing'];

await waitForRiskScoresToBePresent({ es, log, scoreCount: 10 });

const transformStats = await es.transform.getTransformStats({
Expand All @@ -113,12 +116,12 @@ export default ({ getService }: FtrProviderContext): void => {

expect(transformStats.transforms.length).to.eql(1);
const latestTransform = transformStats.transforms[0];
if (latestTransform.state !== 'started') {
log.error('Transform state is not started, logging the transform');
if (!TRANSFORM_STARTED_STATES.includes(latestTransform.state)) {
log.error('Transform state is not in the started states, logging the transform');
log.info(`latestTransform: ${JSON.stringify(latestTransform)}`);
}

expect(latestTransform.state).to.eql('started');
expect(TRANSFORM_STARTED_STATES).to.contain(latestTransform.state);
});

describe('@skipInServerlessMKI disabling and re-enabling the risk engine', () => {
Expand Down

0 comments on commit f39b04b

Please sign in to comment.