-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] Add tests for anomaly embeddables migrations #116520
Merged
qn895
merged 8 commits into
elastic:main
from
qn895:ml-func-test-anomaly-dashboard-migrations
Nov 3, 2021
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4dc2786
[ML] Add tests for anomaly charts embeddable migrations
qn895 40fe1a8
Merge branch 'master' into ml-func-test-anomaly-dashboard-migrations
kibanamachine 640b06c
Merge branch 'main' into ml-func-test-anomaly-dashboard-migrations
kibanamachine eee3561
[ML] Broaden tests for anomaly swimlane as well
qn895 c32274c
[ML] Fix function rename
qn895 7e51b01
[ML] Update tests to use bulk api
qn895 7449472
[ML] Remove override
qn895 e2e1ae2
Merge branch 'main' into ml-func-test-anomaly-dashboard-migrations
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ const testDataList = [ | |
panelTitle: `ML anomaly charts for ${JOB_CONFIG.job_id}`, | ||
jobConfig: JOB_CONFIG, | ||
datafeedConfig: DATAFEED_CONFIG, | ||
dashboardTitle: `ML anomaly charts for fq_multi_1_ae ${Date.now()}`, | ||
expected: { | ||
influencers: [ | ||
{ | ||
|
@@ -59,7 +60,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { | |
const ml = getService('ml'); | ||
const PageObjects = getPageObjects(['common', 'timePicker', 'dashboard']); | ||
|
||
describe('anomaly charts', function () { | ||
describe('anomaly charts in dashboard', function () { | ||
this.tags(['mlqa']); | ||
|
||
before(async () => { | ||
|
@@ -69,6 +70,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { | |
await ml.securityUI.loginAsMlPowerUser(); | ||
}); | ||
|
||
after(async () => { | ||
await ml.api.cleanMlIndices(); | ||
}); | ||
|
||
for (const testData of testDataList) { | ||
describe(testData.suiteSuffix, function () { | ||
before(async () => { | ||
|
@@ -79,12 +84,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { | |
await PageObjects.common.navigateToApp('dashboard'); | ||
}); | ||
|
||
after(async () => { | ||
await ml.api.cleanMlIndices(); | ||
}); | ||
|
||
it('can open job selection flyout', async () => { | ||
await PageObjects.dashboard.clickCreateDashboardPrompt(); | ||
await PageObjects.dashboard.clickNewDashboard(); | ||
await ml.dashboardEmbeddables.assertDashboardIsEmpty(); | ||
await ml.dashboardEmbeddables.openJobSelectionFlyout(); | ||
}); | ||
|
@@ -109,8 +110,52 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { | |
await PageObjects.timePicker.pauseAutoRefresh(); | ||
await ml.dashboardEmbeddables.assertAnomalyChartsSeverityThresholdControlExists(); | ||
await ml.dashboardEmbeddables.assertAnomalyChartsExists(); | ||
await PageObjects.dashboard.saveDashboard(testData.dashboardTitle); | ||
}); | ||
}); | ||
} | ||
|
||
describe('supports migrations', function () { | ||
const panelTitle = `Saved ML anomaly charts for fq_multi_1_ae`; | ||
const dashboardSavedObject = { | ||
attributes: { | ||
title: `ML anomaly charts 7.15 dashboard ${Date.now()}`, | ||
description: '', | ||
panelsJSON: `[{"version":"7.15.2","type":"ml_anomaly_charts","gridData":{"x":0,"y":0,"w":36,"h":20,"i":"ffcdb1ed-0079-41ee-8dda-3f6c138182ab"},"panelIndex":"ffcdb1ed-0079-41ee-8dda-3f6c138182ab","embeddableConfig":{"jobIds":["fq_multi_1_ae"],"maxSeriesToPlot":6,"severityThreshold":0,"enhancements":{}},"title":"${panelTitle}"}]`, | ||
optionsJSON: '{"useMargins":true,"syncColors":false,"hidePanelTitles":false}', | ||
timeRestore: true, | ||
timeTo: '2016-02-11T00:00:00.000Z', | ||
timeFrom: '2016-02-07T00:00:00.000Z', | ||
refreshInterval: { | ||
pause: true, | ||
value: 0, | ||
}, | ||
kibanaSavedObjectMeta: { | ||
searchSourceJSON: '{"query":{"query":"","language":"kuery"},"filter":[]}', | ||
}, | ||
}, | ||
coreMigrationVersion: '7.15.2', | ||
}; | ||
|
||
before(async () => { | ||
await ml.testResources.createDashboardSavedObject( | ||
dashboardSavedObject.attributes.title, | ||
dashboardSavedObject | ||
); | ||
await PageObjects.common.navigateToApp('dashboard'); | ||
}); | ||
|
||
it('loads saved dashboard from version 7.15', async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated here eee3561 |
||
await PageObjects.dashboard.loadSavedDashboard(dashboardSavedObject.attributes.title); | ||
await ml.dashboardEmbeddables.assertDashboardPanelExists(panelTitle); | ||
await PageObjects.timePicker.setAbsoluteRange( | ||
'Feb 7, 2016 @ 00:00:00.000', | ||
'Feb 11, 2016 @ 00:00:00.000' | ||
); | ||
await PageObjects.timePicker.pauseAutoRefresh(); | ||
await ml.dashboardEmbeddables.assertAnomalyChartsSeverityThresholdControlExists(); | ||
await ml.dashboardEmbeddables.assertAnomalyChartsExists(); | ||
}); | ||
}); | ||
}); | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth moving the saved object configs and then looping through each item in the list, making sure it can be loaded successfully. Then for 8.0, a
7.16
config can be added with minimal changes to the code required.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here eee3561