import type { ESUpgradeStatus , EnrichedDeprecationInfo } from '../../../common/types' ; import { indexSettingDeprecations } from '../../../common/constants' ; export const MOCK_SNAPSHOT_ID = '1' ; export const MOCK_JOB_ID = 'deprecation_check_job' ; export const MOCK_ML_DEPRECATION = { isCritical : true , resolveDuringUpgrade : false , type : 'ml_settings' , 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]' , url : 'doc_url' , correctiveAction : { type : 'mlSnapshot' , snapshotId : MOCK_SNAPSHOT_ID , jobId : MOCK_JOB_ID , } , } ; const MOCK_REINDEX_DEPRECATION = { isCritical : true , resolveDuringUpgrade : false , type : 'index_settings' , message : 'Index created before 7.0' , details : 'deprecation details' , url : 'doc_url' , index : 'reindex_index' , correctiveAction : { type : 'reindex' , } , } ; const MOCK_INDEX_SETTING_DEPRECATION = { isCritical : false , resolveDuringUpgrade : false , type : 'index_settings' , message : indexSettingDeprecations . translog . deprecationMessage , details : 'deprecation details' , url : 'doc_url' , index : 'my_index' , correctiveAction : { type : 'indexSetting' , deprecatedSettings : indexSettingDeprecations . translog . settings , } , } ; const MOCK_DEFAULT_DEPRECATION = { isCritical : false , resolveDuringUpgrade : false , type : 'index_settings' , message : 'multi-fields within multi-fields' , details : 'deprecation details' , url : 'doc_url' , index : 'nested_multi-fields' , } ; export const esDeprecationsMockResponse = { totalCriticalDeprecations : 2 , deprecations : [ MOCK_ML_DEPRECATION , MOCK_INDEX_SETTING_DEPRECATION , MOCK_DEFAULT_DEPRECATION , MOCK_REINDEX_DEPRECATION , ] , } ; export const createEsDeprecationsMockResponse = ( numDeprecationsPerType ) : ESUpgradeStatus => { const mlDeprecations = Array . from ( { length : numDeprecationsPerType , } , ( ) => MOCK_ML_DEPRECATION ) ; const indexSettingsDeprecations = Array . from ( { length : numDeprecationsPerType , } , ( ) => MOCK_INDEX_SETTING_DEPRECATION ) ; const reindexDeprecations = Array . from ( { length : numDeprecationsPerType , } , ( ) => MOCK_REINDEX_DEPRECATION ) ; const defaultDeprecations = Array . from ( { length : numDeprecationsPerType , } , ( ) => MOCK_DEFAULT_DEPRECATION ) ; const deprecations = [ ... defaultDeprecations , ... reindexDeprecations , ... indexSettingsDeprecations , ... mlDeprecations , ] ; return { totalCriticalDeprecations : mlDeprecations . length + reindexDeprecations . length , deprecations , } ; } ;