[ML] Functional tests - stabilize AD job delete test (#88148)

This PR stabilizes the AD job delete tests by waiting for the job to not exist anymore before checking the job list.
This commit is contained in:
Robert Oskamp 2021-01-13 15:04:38 +01:00 committed by GitHub
parent 4c5d8be8da
commit e274a60927
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View file

@ -343,6 +343,7 @@ export default function ({ getService }: FtrProviderContext) {
await ml.testExecution.logTestStep('job deletion confirms the delete modal');
await ml.jobTable.confirmDeleteJobModal();
await ml.api.waitForAnomalyDetectionJobNotToExist(jobIdClone, 30 * 1000);
await ml.testExecution.logTestStep(
'job deletion does not display the deleted job in the job list any more'

View file

@ -326,6 +326,7 @@ export default function ({ getService }: FtrProviderContext) {
await ml.testExecution.logTestStep('job deletion confirms the delete modal');
await ml.jobTable.confirmDeleteJobModal();
await ml.api.waitForAnomalyDetectionJobNotToExist(jobIdClone, 30 * 1000);
await ml.testExecution.logTestStep(
'job deletion does not display the deleted job in the job list any more'

View file

@ -454,8 +454,8 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
return await esSupertest.get(`/_ml/anomaly_detectors/${jobId}`).expect(200);
},
async waitForAnomalyDetectionJobToExist(jobId: string) {
await retry.waitForWithTimeout(`'${jobId}' to exist`, 5 * 1000, async () => {
async waitForAnomalyDetectionJobToExist(jobId: string, timeout: number = 5 * 1000) {
await retry.waitForWithTimeout(`'${jobId}' to exist`, timeout, async () => {
if (await this.getAnomalyDetectionJob(jobId)) {
return true;
} else {
@ -464,8 +464,8 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
});
},
async waitForAnomalyDetectionJobNotToExist(jobId: string) {
await retry.waitForWithTimeout(`'${jobId}' to not exist`, 5 * 1000, async () => {
async waitForAnomalyDetectionJobNotToExist(jobId: string, timeout: number = 5 * 1000) {
await retry.waitForWithTimeout(`'${jobId}' to not exist`, timeout, async () => {
if (await esSupertest.get(`/_ml/anomaly_detectors/${jobId}`).expect(404)) {
return true;
} else {