[Upgrade assistant] Fix the "Fix" button for ML snapshots in need of upgrade (#119745) (#119850)

The deprecations for ML snapshots that are too old and need
upgrading are supposed to have a "Fix" button next to them.
Unfortunately this disappeared when a message was reworded
in elastic/elasticsearch#79387.

This change adjusts the regex that the upgrade assistant
uses to detect which deprecations to add the "Fix" button
to so that it will match both "Model snapshot" and "model
snapshot". The test data is also updated to match the new
backend text.

This change is designed to work with elastic/elasticsearch#81060.

Co-authored-by: David Roberts <dave.roberts@elastic.co>
This commit is contained in:
Kibana Machine 2021-11-29 11:08:51 -05:00 committed by GitHub
parent 12d4882904
commit e792a294f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 5 deletions

View file

@ -139,7 +139,7 @@ const getCorrectiveAction = (
);
const requiresReindexAction = /Index created before/.test(message);
const requiresIndexSettingsAction = Boolean(indexSettingDeprecation);
const requiresMlAction = /model snapshot/.test(message);
const requiresMlAction = /[Mm]odel snapshot/.test(message);
if (requiresReindexAction) {
return {

View file

@ -63,7 +63,7 @@ const verifySnapshotUpgrade = async (
const { body: deprecations } = await esClient.asCurrentUser.migration.deprecations();
const mlSnapshotDeprecations = deprecations.ml_settings.filter((deprecation) => {
return /model snapshot/.test(deprecation.message);
return /[Mm]odel snapshot/.test(deprecation.message);
});
// If there are no ML deprecations, we assume the deprecation was resolved successfully

View file

@ -49,9 +49,8 @@ describe('Status API', () => {
{
level: 'critical',
message:
'model snapshot [1] for job [deprecation_check_job] needs to be deleted or upgraded',
details:
'model snapshot [%s] for job [%s] supports minimum version [%s] and needs to be at least [%s]',
'Model snapshot [1] for job [deprecation_check_job] has an obsolete minimum version [6.3.0].',
details: 'Delete model snapshot [1] or update it to 7.0.0 or greater.',
url: 'doc_url',
correctiveAction: {
type: 'mlSnapshot',