diff --git a/packages/kbn-ftr-common-functional-services/services/retry/retry.ts b/packages/kbn-ftr-common-functional-services/services/retry/retry.ts index b0ea9ab97fba..383e37511ef8 100644 --- a/packages/kbn-ftr-common-functional-services/services/retry/retry.ts +++ b/packages/kbn-ftr-common-functional-services/services/retry/retry.ts @@ -17,24 +17,25 @@ export class RetryService extends FtrService { public async tryForTime( timeout: number, block: () => Promise, - onFailureBlock?: () => Promise + onFailureBlock?: () => Promise, + retryDelay?: number ) { return await retryForSuccess(this.log, { timeout, methodName: 'retry.tryForTime', block, onFailureBlock, + retryDelay, }); } public async try( block: () => Promise, onFailureBlock?: () => Promise, - retryDelay?: number, - timeout?: number + retryDelay?: number ) { return await retryForSuccess(this.log, { - timeout: timeout ?? this.config.get('timeouts.try'), + timeout: this.config.get('timeouts.try'), methodName: 'retry.try', block, onFailureBlock, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/retry.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/retry.ts index b545519b7df3..cbe31ead0034 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/retry.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/retry.ts @@ -19,10 +19,11 @@ export const retry = async ({ test: () => Promise; retryService: RetryService; retries: number; - timeout?: number; + timeout: number; }): Promise => { let retryAttempt = 0; - const response = await retryService.try( + const response = await retryService.tryForTime( + timeout, async () => { if (retryAttempt > retries) { // Log error message if we reached the maximum number of retries @@ -35,8 +36,7 @@ export const retry = async ({ return test(); }, undefined, - 200, - timeout + 200 ); // Now throw the error in order to fail the test.