mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[8.16] [EDR Workflows] Improve on unavailable shard exception flakiness in cypress (#197864) (#198137)
# Backport This will backport the following commits from `main` to `8.16`: - [[EDR Workflows] Improve on unavailable shard exception flakiness in cypress (#197864)](https://github.com/elastic/kibana/pull/197864) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Gergő Ábrahám","email":"gergo.abraham@elastic.co"},"sourceCommit":{"committedDate":"2024-10-29T10:52:36Z","message":"[EDR Workflows] Improve on unavailable shard exception flakiness in cypress (#197864)\n\n## Summary\r\n\r\nThe cypress task `cy.task('indexEndpointHosts')` sometimes throws\r\n`no_shard_available_action_exception`, when transforms are stopped. This\r\nlooks like a temporary issue, and in other tests it is simply retried.\r\n\r\nThis PR adds the retry logic for this type of error, and unskips some\r\ntests.\r\n\r\ncloses #194135\r\ncloses #191914\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n- [x] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed","sha":"db18039dc40bc0e994be666a83a28a0452a0c6e2","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Defend Workflows","v8.16.0","backport:version","v8.17.0"],"title":"[EDR Workflows] Improve on unavailable shard exception flakiness in cypress","number":197864,"url":"https://github.com/elastic/kibana/pull/197864","mergeCommit":{"message":"[EDR Workflows] Improve on unavailable shard exception flakiness in cypress (#197864)\n\n## Summary\r\n\r\nThe cypress task `cy.task('indexEndpointHosts')` sometimes throws\r\n`no_shard_available_action_exception`, when transforms are stopped. This\r\nlooks like a temporary issue, and in other tests it is simply retried.\r\n\r\nThis PR adds the retry logic for this type of error, and unskips some\r\ntests.\r\n\r\ncloses #194135\r\ncloses #191914\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n- [x] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed","sha":"db18039dc40bc0e994be666a83a28a0452a0c6e2"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197864","number":197864,"mergeCommit":{"message":"[EDR Workflows] Improve on unavailable shard exception flakiness in cypress (#197864)\n\n## Summary\r\n\r\nThe cypress task `cy.task('indexEndpointHosts')` sometimes throws\r\n`no_shard_available_action_exception`, when transforms are stopped. This\r\nlooks like a temporary issue, and in other tests it is simply retried.\r\n\r\nThis PR adds the retry logic for this type of error, and unskips some\r\ntests.\r\n\r\ncloses #194135\r\ncloses #191914\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n- [x] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed","sha":"db18039dc40bc0e994be666a83a28a0452a0c6e2"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Gergő Ábrahám <gergo.abraham@elastic.co>
This commit is contained in:
parent
678244f8e2
commit
b7c86966f8
2 changed files with 29 additions and 18 deletions
|
@ -35,8 +35,7 @@ const loginWithoutAccess = (url: string) => {
|
|||
loadPage(url);
|
||||
};
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/191914
|
||||
describe.skip('Artifacts pages', { tags: ['@ess', '@serverless', '@skipInServerlessMKI'] }, () => {
|
||||
describe('Artifacts pages', { tags: ['@ess', '@serverless', '@skipInServerlessMKI'] }, () => {
|
||||
let endpointData: ReturnTypeFromChainable<typeof indexEndpointHosts> | undefined;
|
||||
|
||||
before(() => {
|
||||
|
|
|
@ -10,6 +10,10 @@ import type { KbnClient } from '@kbn/test';
|
|||
import pRetry from 'p-retry';
|
||||
import { kibanaPackageJson } from '@kbn/repo-info';
|
||||
import type { ToolingLog } from '@kbn/tooling-log';
|
||||
import {
|
||||
RETRYABLE_TRANSIENT_ERRORS,
|
||||
retryOnError,
|
||||
} from '../../../../../common/endpoint/data_loaders/utils';
|
||||
import { fetchFleetLatestAvailableAgentVersion } from '../../../../../common/endpoint/utils/fetch_fleet_version';
|
||||
import { dump } from '../../../../../scripts/endpoint/common/utils';
|
||||
import { STARTED_TRANSFORM_STATES } from '../../../../../common/constants';
|
||||
|
@ -158,18 +162,17 @@ const stopTransform = async (
|
|||
): Promise<void> => {
|
||||
log.debug(`Stopping transform id: ${transformId}`);
|
||||
|
||||
await esClient.transform
|
||||
.stopTransform({
|
||||
transform_id: `${transformId}*`,
|
||||
force: true,
|
||||
wait_for_completion: true,
|
||||
allow_no_match: true,
|
||||
})
|
||||
.catch((e) => {
|
||||
Error.captureStackTrace(e);
|
||||
log.verbose(dump(e, 8));
|
||||
throw e;
|
||||
});
|
||||
await retryOnError(
|
||||
() =>
|
||||
esClient.transform.stopTransform({
|
||||
transform_id: `${transformId}*`,
|
||||
force: true,
|
||||
wait_for_completion: true,
|
||||
allow_no_match: true,
|
||||
}),
|
||||
RETRYABLE_TRANSIENT_ERRORS,
|
||||
log
|
||||
);
|
||||
};
|
||||
|
||||
const startTransform = async (
|
||||
|
@ -177,9 +180,14 @@ const startTransform = async (
|
|||
log: ToolingLog,
|
||||
transformId: string
|
||||
): Promise<void> => {
|
||||
const transformsResponse = await esClient.transform.getTransformStats({
|
||||
transform_id: `${transformId}*`,
|
||||
});
|
||||
const transformsResponse = await retryOnError(
|
||||
() =>
|
||||
esClient.transform.getTransformStats({
|
||||
transform_id: `${transformId}*`,
|
||||
}),
|
||||
RETRYABLE_TRANSIENT_ERRORS,
|
||||
log
|
||||
);
|
||||
|
||||
log.verbose(
|
||||
`Transform status found for [${transformId}*] returned:\n${dump(transformsResponse)}`
|
||||
|
@ -193,7 +201,11 @@ const startTransform = async (
|
|||
|
||||
log.debug(`Staring transform id: [${transform.id}]`);
|
||||
|
||||
return esClient.transform.startTransform({ transform_id: transform.id });
|
||||
return retryOnError(
|
||||
() => esClient.transform.startTransform({ transform_id: transform.id }),
|
||||
RETRYABLE_TRANSIENT_ERRORS,
|
||||
log
|
||||
);
|
||||
})
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue