Skip to content

Commit

Permalink
[8.x] [Security Solution] Reduce flakiness in functions for installin…
Browse files Browse the repository at this point in the history
…g Fleet package with prebuilt rules (elastic#204823) (elastic#205048)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution] Reduce flakiness in functions for installing
Fleet package with prebuilt rules
(elastic#204823)](elastic#204823)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Georgii
Gorbachev","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-20T14:07:17Z","message":"[Security
Solution] Reduce flakiness in functions for installing Fleet package
with prebuilt rules (elastic#204823)\n\n**Fixes:
https://github.com/elastic/kibana/issues/204812**\r\n\r\n##
Summary\r\n\r\nThis PR increases the total timeout for installing the
prebuilt rules\r\npackage from the API integration tests from 2 minutes
to 6 minutes,\r\nwhere 6 minutes = 2 minutes * 3 attempts.\r\n\r\nLogic
before the fix:\r\n- If the first attempt takes more than 2 minutes, it
will continue to\r\nrun.\r\n- If the first attempt takes less than 2
minutes, there will be a second\r\none.\r\n- If the first attempt takes
more than 2 minutes, there won't be a\r\nsecond one.\r\n\r\nLogic after
the fix:\r\n- If the first attempt takes more than 2 minutes, it will
continue to\r\nrun.\r\n- If the first attempt takes less than 2 minutes,
there will be a second\r\none.\r\n- If the first attempt takes more than
2 minutes but less than 6, there\r\nwill be a second one.\r\n- If the
first attempt takes more than 6 minutes, there won't be a\r\nsecond
one.\r\n\r\nContext:\r\nhttps://github.com/elastic/issues/204812#issuecomment-2552010657\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"39091fc30ba274f155cb807ef5de4e98bcc1072f","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","v9.0.0","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v8.18.0","v8.16.3","v8.17.1"],"title":"[Security
Solution] Reduce flakiness in functions for installing Fleet package
with prebuilt
rules","number":204823,"url":"https://github.com/elastic/kibana/pull/204823","mergeCommit":{"message":"[Security
Solution] Reduce flakiness in functions for installing Fleet package
with prebuilt rules (elastic#204823)\n\n**Fixes:
https://github.com/elastic/kibana/issues/204812**\r\n\r\n##
Summary\r\n\r\nThis PR increases the total timeout for installing the
prebuilt rules\r\npackage from the API integration tests from 2 minutes
to 6 minutes,\r\nwhere 6 minutes = 2 minutes * 3 attempts.\r\n\r\nLogic
before the fix:\r\n- If the first attempt takes more than 2 minutes, it
will continue to\r\nrun.\r\n- If the first attempt takes less than 2
minutes, there will be a second\r\none.\r\n- If the first attempt takes
more than 2 minutes, there won't be a\r\nsecond one.\r\n\r\nLogic after
the fix:\r\n- If the first attempt takes more than 2 minutes, it will
continue to\r\nrun.\r\n- If the first attempt takes less than 2 minutes,
there will be a second\r\none.\r\n- If the first attempt takes more than
2 minutes but less than 6, there\r\nwill be a second one.\r\n- If the
first attempt takes more than 6 minutes, there won't be a\r\nsecond
one.\r\n\r\nContext:\r\nhttps://github.com/elastic/issues/204812#issuecomment-2552010657\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"39091fc30ba274f155cb807ef5de4e98bcc1072f"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.16","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204823","number":204823,"mergeCommit":{"message":"[Security
Solution] Reduce flakiness in functions for installing Fleet package
with prebuilt rules (elastic#204823)\n\n**Fixes:
https://github.com/elastic/kibana/issues/204812**\r\n\r\n##
Summary\r\n\r\nThis PR increases the total timeout for installing the
prebuilt rules\r\npackage from the API integration tests from 2 minutes
to 6 minutes,\r\nwhere 6 minutes = 2 minutes * 3 attempts.\r\n\r\nLogic
before the fix:\r\n- If the first attempt takes more than 2 minutes, it
will continue to\r\nrun.\r\n- If the first attempt takes less than 2
minutes, there will be a second\r\none.\r\n- If the first attempt takes
more than 2 minutes, there won't be a\r\nsecond one.\r\n\r\nLogic after
the fix:\r\n- If the first attempt takes more than 2 minutes, it will
continue to\r\nrun.\r\n- If the first attempt takes less than 2 minutes,
there will be a second\r\none.\r\n- If the first attempt takes more than
2 minutes but less than 6, there\r\nwill be a second one.\r\n- If the
first attempt takes more than 6 minutes, there won't be a\r\nsecond
one.\r\n\r\nContext:\r\nhttps://github.com/elastic/issues/204812#issuecomment-2552010657\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"39091fc30ba274f155cb807ef5de4e98bcc1072f"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Georgii Gorbachev <[email protected]>
  • Loading branch information
kibanamachine and banderror authored Dec 20, 2024
1 parent 7d91aff commit 5369c25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import expect from 'expect';
import { refreshSavedObjectIndices } from '../../refresh_index';

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

/**
* Installs latest available non-prerelease prebuilt rules package `security_detection_engine`.
Expand Down Expand Up @@ -46,7 +46,7 @@ export const installPrebuiltRulesPackageViaFleetAPI = async (
},
{
retryCount: MAX_RETRIES,
timeout: ATTEMPT_TIMEOUT,
timeout: TOTAL_TIMEOUT,
}
);

Expand Down Expand Up @@ -87,7 +87,7 @@ export const installPrebuiltRulesPackageByVersion = async (
},
{
retryCount: MAX_RETRIES,
timeout: ATTEMPT_TIMEOUT,
timeout: TOTAL_TIMEOUT,
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import expect from 'expect';
import { refreshSavedObjectIndices } from '../../refresh_index';

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

/**
* Installs the `security_detection_engine` package via fleet API. This will
Expand Down Expand Up @@ -60,7 +60,7 @@ export const installPrebuiltRulesFleetPackage = async ({
},
{
retryCount: MAX_RETRIES,
timeout: ATTEMPT_TIMEOUT,
timeout: TOTAL_TIMEOUT,
}
);

Expand Down Expand Up @@ -94,7 +94,7 @@ export const installPrebuiltRulesFleetPackage = async ({
},
{
retryCount: MAX_RETRIES,
timeout: ATTEMPT_TIMEOUT,
timeout: TOTAL_TIMEOUT,
}
);

Expand Down

0 comments on commit 5369c25

Please sign in to comment.