Skip to content

Commit

Permalink
[Security Solution] Make retry messages in `retryIfDeleteByQueryConfl…
Browse files Browse the repository at this point in the history
…icts` loggable (elastic#193117)

## Summary

This makes retry messages in `retryIfDeleteByQueryConflicts()` helper function visible in CI logs.

## Details

According to the [implementation](https://github.com/elastic/kibana/blob/main/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/reporter.js#L71-L74) only error messages logged via `ToolingLog` piped to the CI log. It happens only when `mochaReporter.captureLogOutput` flag is set to `true`. According to the [schema](https://github.com/elastic/kibana/blob/eabb1022815a7c661a0e642c62d0a77ce338f9c9/packages/kbn-test/src/functional_test_runner/lib/config/schema.ts#L175) `captureLogOutput` has `true` value in CI and there is no `DISABLE_CI_LOG_OUTPUT_CAPTURE` env variable set.

It was [tested](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6978#01920936-b484-4dfb-a87b-ae40858c9ff5) in flaky test runner. Error messages a logged as expected.
  • Loading branch information
maximpn authored Sep 19, 2024
1 parent f6cff85 commit 067d949
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ export async function retryIfDeleteByQueryConflicts(
const operationResult = await operation();

if (!operationResult.failures || operationResult.failures?.length === 0) {
logger.info(`${name} finished successfully`);
return operationResult;
}

const failureCause = operationResult.failures.map((failure) => failure.cause).join(', ');

logger.warning(`Unable to delete by query ${name}. Caused by: "${failureCause}". Retrying ...`);
logger.error(`Unable to delete by query ${name}. Caused by: "${failureCause}". Retrying ...`);

await waitBeforeNextRetry(retryDelay);
}
Expand Down

0 comments on commit 067d949

Please sign in to comment.