-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Add functional tests for Transform start/delete (#92314)
- Loading branch information
Showing
9 changed files
with
426 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { TRANSFORM_STATE } from '../../../../plugins/transform/common/constants'; | ||
|
||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
import { getLatestTransformConfig, getPivotTransformConfig } from './index'; | ||
|
||
export default function ({ getService }: FtrProviderContext) { | ||
const esArchiver = getService('esArchiver'); | ||
const transform = getService('transform'); | ||
|
||
describe('deleting', function () { | ||
const PREFIX = 'deleting'; | ||
|
||
const testDataList = [ | ||
{ | ||
suiteTitle: 'batch transform with pivot configuration', | ||
originalConfig: getPivotTransformConfig(PREFIX, false), | ||
expected: { | ||
row: { | ||
status: TRANSFORM_STATE.STOPPED, | ||
mode: 'batch', | ||
progress: 100, | ||
}, | ||
}, | ||
}, | ||
{ | ||
suiteTitle: 'continuous transform with pivot configuration', | ||
originalConfig: getPivotTransformConfig(PREFIX, true), | ||
expected: { | ||
row: { | ||
status: TRANSFORM_STATE.STOPPED, | ||
mode: 'continuous', | ||
progress: undefined, | ||
}, | ||
}, | ||
}, | ||
{ | ||
suiteTitle: 'batch transform with latest configuration', | ||
originalConfig: getLatestTransformConfig(PREFIX), | ||
transformDescription: 'updated description', | ||
transformDocsPerSecond: '1000', | ||
transformFrequency: '10m', | ||
expected: { | ||
messageText: 'updated transform.', | ||
row: { | ||
status: TRANSFORM_STATE.STOPPED, | ||
mode: 'batch', | ||
progress: 100, | ||
}, | ||
}, | ||
}, | ||
]; | ||
|
||
before(async () => { | ||
await esArchiver.loadIfNeeded('ml/ecommerce'); | ||
await transform.testResources.createIndexPatternIfNeeded('ft_ecommerce', 'order_date'); | ||
|
||
for (const testData of testDataList) { | ||
await transform.api.createAndRunTransform( | ||
testData.originalConfig.id, | ||
testData.originalConfig | ||
); | ||
} | ||
|
||
await transform.testResources.setKibanaTimeZoneToUTC(); | ||
await transform.securityUI.loginAsTransformPowerUser(); | ||
}); | ||
|
||
after(async () => { | ||
for (const testData of testDataList) { | ||
await transform.testResources.deleteIndexPatternByTitle(testData.originalConfig.dest.index); | ||
await transform.api.deleteIndices(testData.originalConfig.dest.index); | ||
} | ||
await transform.api.cleanTransformIndices(); | ||
}); | ||
|
||
for (const testData of testDataList) { | ||
describe(`${testData.suiteTitle}`, function () { | ||
it('delete transform', async () => { | ||
await transform.testExecution.logTestStep('should load the home page'); | ||
await transform.navigation.navigateTo(); | ||
await transform.management.assertTransformListPageExists(); | ||
|
||
await transform.testExecution.logTestStep('should display the transforms table'); | ||
await transform.management.assertTransformsTableExists(); | ||
|
||
if (testData.expected.row.mode === 'continuous') { | ||
await transform.testExecution.logTestStep('should have the delete action disabled'); | ||
await transform.table.assertTransformRowActionEnabled( | ||
testData.originalConfig.id, | ||
'Delete', | ||
false | ||
); | ||
|
||
await transform.testExecution.logTestStep('should stop the transform'); | ||
await transform.table.clickTransformRowActionWithRetry( | ||
testData.originalConfig.id, | ||
'Stop' | ||
); | ||
} | ||
|
||
await transform.testExecution.logTestStep('should display the stopped transform'); | ||
await transform.table.assertTransformRowFields(testData.originalConfig.id, { | ||
id: testData.originalConfig.id, | ||
description: testData.originalConfig.description, | ||
status: testData.expected.row.status, | ||
mode: testData.expected.row.mode, | ||
progress: testData.expected.row.progress, | ||
}); | ||
|
||
await transform.testExecution.logTestStep('should show the delete modal'); | ||
await transform.table.assertTransformRowActionEnabled( | ||
testData.originalConfig.id, | ||
'Delete', | ||
true | ||
); | ||
await transform.table.clickTransformRowActionWithRetry( | ||
testData.originalConfig.id, | ||
'Delete' | ||
); | ||
await transform.table.assertTransformDeleteModalExists(); | ||
|
||
await transform.testExecution.logTestStep('should delete the transform'); | ||
await transform.table.confirmDeleteTransform(); | ||
await transform.table.assertTransformRowNotExists(testData.originalConfig.id); | ||
}); | ||
}); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
import { TRANSFORM_STATE } from '../../../../plugins/transform/common/constants'; | ||
import { getLatestTransformConfig, getPivotTransformConfig } from './index'; | ||
|
||
export default function ({ getService }: FtrProviderContext) { | ||
const esArchiver = getService('esArchiver'); | ||
const transform = getService('transform'); | ||
|
||
describe('starting', function () { | ||
const PREFIX = 'starting'; | ||
const testDataList = [ | ||
{ | ||
suiteTitle: 'batch transform with pivot configuration', | ||
originalConfig: getPivotTransformConfig(PREFIX, false), | ||
mode: 'batch', | ||
}, | ||
{ | ||
suiteTitle: 'continuous transform with pivot configuration', | ||
originalConfig: getPivotTransformConfig(PREFIX, true), | ||
mode: 'continuous', | ||
}, | ||
{ | ||
suiteTitle: 'batch transform with latest configuration', | ||
originalConfig: getLatestTransformConfig(PREFIX, false), | ||
mode: 'batch', | ||
}, | ||
{ | ||
suiteTitle: 'continuous transform with latest configuration', | ||
originalConfig: getLatestTransformConfig(PREFIX, true), | ||
mode: 'continuous', | ||
}, | ||
]; | ||
|
||
before(async () => { | ||
await esArchiver.loadIfNeeded('ml/ecommerce'); | ||
await transform.testResources.createIndexPatternIfNeeded('ft_ecommerce', 'order_date'); | ||
|
||
for (const testData of testDataList) { | ||
await transform.api.createTransform(testData.originalConfig.id, testData.originalConfig); | ||
} | ||
await transform.testResources.setKibanaTimeZoneToUTC(); | ||
await transform.securityUI.loginAsTransformPowerUser(); | ||
}); | ||
|
||
after(async () => { | ||
for (const testData of testDataList) { | ||
await transform.testResources.deleteIndexPatternByTitle(testData.originalConfig.dest.index); | ||
await transform.api.deleteIndices(testData.originalConfig.dest.index); | ||
} | ||
|
||
await transform.api.cleanTransformIndices(); | ||
}); | ||
|
||
for (const testData of testDataList) { | ||
const transformId = testData.originalConfig.id; | ||
|
||
describe(`${testData.suiteTitle}`, function () { | ||
it('start transform', async () => { | ||
await transform.testExecution.logTestStep('should load the home page'); | ||
await transform.navigation.navigateTo(); | ||
await transform.management.assertTransformListPageExists(); | ||
|
||
await transform.testExecution.logTestStep('should display the transforms table'); | ||
await transform.management.assertTransformsTableExists(); | ||
|
||
await transform.testExecution.logTestStep( | ||
'should display the original transform in the transform list' | ||
); | ||
await transform.table.filterWithSearchString(transformId, 1); | ||
|
||
await transform.testExecution.logTestStep('should start the transform'); | ||
await transform.table.assertTransformRowActionEnabled(transformId, 'Start', true); | ||
await transform.table.clickTransformRowActionWithRetry(transformId, 'Start'); | ||
await transform.table.confirmStartTransform(); | ||
await transform.table.clearSearchString(testDataList.length); | ||
|
||
if (testData.mode === 'continuous') { | ||
await transform.testExecution.logTestStep('should display the started transform'); | ||
await transform.table.assertTransformRowStatusNotEql( | ||
testData.originalConfig.id, | ||
TRANSFORM_STATE.STOPPED | ||
); | ||
} else { | ||
await transform.table.assertTransformRowProgressGreaterThan(transformId, 0); | ||
} | ||
|
||
await transform.table.assertTransformRowStatusNotEql( | ||
testData.originalConfig.id, | ||
TRANSFORM_STATE.FAILED | ||
); | ||
await transform.table.assertTransformRowStatusNotEql( | ||
testData.originalConfig.id, | ||
TRANSFORM_STATE.ABORTING | ||
); | ||
}); | ||
}); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.