Skip to content

Commit

Permalink
[ML] Functional tests - add retry to Fleet package install and removal
Browse files Browse the repository at this point in the history
  • Loading branch information
pheyos committed Dec 1, 2021
1 parent f7bafd6 commit 5f2cea4
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions x-pack/test/functional/services/ml/test_resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,12 @@ export function MachineLearningTestResourcesProvider({ getService }: FtrProvider
const version = await this.getFleetPackageVersion(packageName);
const packageWithVersion = `${packageName}-${version}`;

await supertest
.post(`/api/fleet/epm/packages/${packageWithVersion}`)
.set(COMMON_REQUEST_HEADERS)
.expect(200);
await retry.tryForTime(30 * 1000, async () => {
await supertest
.post(`/api/fleet/epm/packages/${packageWithVersion}`)
.set(COMMON_REQUEST_HEADERS)
.expect(200);
});

log.debug(` > Installed`);
return packageWithVersion;
Expand All @@ -488,10 +490,12 @@ export function MachineLearningTestResourcesProvider({ getService }: FtrProvider
async removeFleetPackage(packageWithVersion: string) {
log.debug(`Removing Fleet package '${packageWithVersion}'`);

await supertest
.delete(`/api/fleet/epm/packages/${packageWithVersion}`)
.set(COMMON_REQUEST_HEADERS)
.expect(200);
await retry.tryForTime(30 * 1000, async () => {
await supertest
.delete(`/api/fleet/epm/packages/${packageWithVersion}`)
.set(COMMON_REQUEST_HEADERS)
.expect(200);
});

log.debug(` > Removed`);
},
Expand Down

0 comments on commit 5f2cea4

Please sign in to comment.