Skip to content

Commit

Permalink
Reduce flakiness in functions for installing Fleet package with prebu…
Browse files Browse the repository at this point in the history
…ilt rules
  • Loading branch information
banderror committed Dec 20, 2024
1 parent fecc6d5 commit 8e3bf33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { refreshSavedObjectIndices } from '../../refresh_index';

const MAX_RETRIES = 2;
const ATTEMPT_TIMEOUT = 120000;
const TOTAL_TIMEOUT = ATTEMPT_TIMEOUT * (1 + MAX_RETRIES);

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

Expand Down Expand Up @@ -87,7 +88,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 @@ -19,6 +19,7 @@ import { refreshSavedObjectIndices } from '../../refresh_index';

const MAX_RETRIES = 2;
const ATTEMPT_TIMEOUT = 120000;
const TOTAL_TIMEOUT = ATTEMPT_TIMEOUT * (1 + MAX_RETRIES);

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

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

Expand Down

0 comments on commit 8e3bf33

Please sign in to comment.