import { config } from './index' ; import { applyDeprecations , configDeprecationFactory } from '@kbn/config' ; import { configDeprecationsMock } from '../../../../src/core/server/mocks' ; const CONFIG_PATH = 'xpack.task_manager' ; const deprecationContext = configDeprecationsMock . createContext ( ) ; const applyTaskManagerDeprecations = ( settings = { } ) => { const deprecations = config . deprecations ! ( configDeprecationFactory ) ; const deprecationMessages = [ ] ; const _config = { [ CONFIG_PATH ] : settings , } ; const { config : migrated } = applyDeprecations ( _config , deprecations . map ( ( deprecation ) => ( { deprecation , path : CONFIG_PATH , context : deprecationContext , } ) ) , ( ) => ( { message } ) => deprecationMessages . push ( message ) ) ; return { messages : deprecationMessages , migrated , } ; } ; describe ( 'deprecations' , ( ) => { it ( 'logs a warning if max_workers is over limit' , ( ) => { const { messages } = applyTaskManagerDeprecations ( { max_workers : 1000 } ) ; expect ( messages ) . toMatchInlineSnapshot ( `
      Array [
        "setting \\"xpack.task_manager.max_workers\\" (1000) greater than 100 is deprecated.",
      ]
    ` ) ; } ) ; } ) ;