Skip to content

Commit 6decc62

Browse files
committed
[Security Solution] Reduce flakiness in functions for installing Fleet package with prebuilt rules (elastic#204823)
**Fixes: elastic#204812 ## Summary This PR increases the total timeout for installing the prebuilt rules package from the API integration tests from 2 minutes to 6 minutes, where 6 minutes = 2 minutes * 3 attempts. Logic before the fix: - If the first attempt takes more than 2 minutes, it will continue to run. - If the first attempt takes less than 2 minutes, there will be a second one. - If the first attempt takes more than 2 minutes, there won't be a second one. Logic after the fix: - If the first attempt takes more than 2 minutes, it will continue to run. - If the first attempt takes less than 2 minutes, there will be a second one. - If the first attempt takes more than 2 minutes but less than 6, there will be a second one. - If the first attempt takes more than 6 minutes, there won't be a second one. Context: elastic#204812 (comment) ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed (cherry picked from commit 39091fc)
1 parent 6b9e6e2 commit 6decc62

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/prebuilt_rules/install_fleet_package_by_url.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import expect from 'expect';
1313
import { refreshSavedObjectIndices } from '../../refresh_index';
1414

1515
const MAX_RETRIES = 2;
16-
const ATTEMPT_TIMEOUT = 120000;
16+
const TOTAL_TIMEOUT = 6 * 60000; // 6 mins, applies to all attempts (1 + MAX_RETRIES)
1717

1818
/**
1919
* Installs latest available non-prerelease prebuilt rules package `security_detection_engine`.
@@ -46,7 +46,7 @@ export const installPrebuiltRulesPackageViaFleetAPI = async (
4646
},
4747
{
4848
retryCount: MAX_RETRIES,
49-
timeout: ATTEMPT_TIMEOUT,
49+
timeout: TOTAL_TIMEOUT,
5050
}
5151
);
5252

@@ -87,7 +87,7 @@ export const installPrebuiltRulesPackageByVersion = async (
8787
},
8888
{
8989
retryCount: MAX_RETRIES,
90-
timeout: ATTEMPT_TIMEOUT,
90+
timeout: TOTAL_TIMEOUT,
9191
}
9292
);
9393

x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/prebuilt_rules/install_prebuilt_rules_fleet_package.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import expect from 'expect';
1818
import { refreshSavedObjectIndices } from '../../refresh_index';
1919

2020
const MAX_RETRIES = 2;
21-
const ATTEMPT_TIMEOUT = 120000;
21+
const TOTAL_TIMEOUT = 6 * 60000; // 6 mins, applies to all attempts (1 + MAX_RETRIES)
2222

2323
/**
2424
* Installs the `security_detection_engine` package via fleet API. This will
@@ -60,7 +60,7 @@ export const installPrebuiltRulesFleetPackage = async ({
6060
},
6161
{
6262
retryCount: MAX_RETRIES,
63-
timeout: ATTEMPT_TIMEOUT,
63+
timeout: TOTAL_TIMEOUT,
6464
}
6565
);
6666

@@ -94,7 +94,7 @@ export const installPrebuiltRulesFleetPackage = async ({
9494
},
9595
{
9696
retryCount: MAX_RETRIES,
97-
timeout: ATTEMPT_TIMEOUT,
97+
timeout: TOTAL_TIMEOUT,
9898
}
9999
);
100100

0 commit comments

Comments
 (0)