From 0892dd42f72b7e15e771ed6d4cbeeb5857d44ba6 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 21 Nov 2024 09:57:35 +1100 Subject: [PATCH] [8.x] [Security Solution] Fix flaky test for multiline diff algorithm (#201019) (#201044) # Backport This will backport the following commits from `main` to `8.x`: - [[Security Solution] Fix flaky test for multiline diff algorithm (#201019)](https://github.com/elastic/kibana/pull/201019) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Georgii Gorbachev --- .../algorithms/multi_line_string_diff_algorithm.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/multi_line_string_diff_algorithm.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/multi_line_string_diff_algorithm.test.ts index 72e87fde6ca2f..8f0b3586066fa 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/multi_line_string_diff_algorithm.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/multi_line_string_diff_algorithm.test.ts @@ -174,9 +174,11 @@ describe('multiLineStringDiffAlgorithm', () => { const result = multiLineStringDiffAlgorithm(mockVersions); const endTime = performance.now(); - // If the regex merge in this function takes over 500ms, this test fails + // If the regex merge in this function takes over 1 sec, this test fails // Performance measurements: https://github.com/elastic/kibana/pull/199388 - expect(endTime - startTime).toBeLessThan(500); + // NOTE: despite the fact that this test runs in ~50ms locally, on CI it + // runs slower and can be flaky even with a 500ms threshold. + expect(endTime - startTime).toBeLessThan(1000); expect(result).toEqual( expect.objectContaining({