-
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.
Deprecate
reporting.index
setting (#84005)
* Deprecating `xpack.reporting.index` setting * Adding unit test * Now with more standard deprecation messages * Updating the xpack.reporting.index docs * Fixing tests Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
145c0a5
commit f9ade90
Showing
3 changed files
with
55 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { config } from './index'; | ||
import { applyDeprecations, configDeprecationFactory } from '@kbn/config'; | ||
|
||
const CONFIG_PATH = 'xpack.reporting'; | ||
|
||
const applyReportingDeprecations = (settings: Record<string, any> = {}) => { | ||
const deprecations = config.deprecations!(configDeprecationFactory); | ||
const deprecationMessages: string[] = []; | ||
const _config: any = {}; | ||
_config[CONFIG_PATH] = settings; | ||
const migrated = applyDeprecations( | ||
_config, | ||
deprecations.map((deprecation) => ({ | ||
deprecation, | ||
path: CONFIG_PATH, | ||
})), | ||
(msg) => deprecationMessages.push(msg) | ||
); | ||
return { | ||
messages: deprecationMessages, | ||
migrated, | ||
}; | ||
}; | ||
|
||
describe('deprecations', () => { | ||
['.foo', '.reporting'].forEach((index) => { | ||
it('logs a warning if index is set', () => { | ||
const { messages } = applyReportingDeprecations({ index }); | ||
expect(messages).toMatchInlineSnapshot(` | ||
Array [ | ||
"\\"xpack.reporting.index\\" is deprecated. Multitenancy by changing \\"kibana.index\\" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details", | ||
] | ||
`); | ||
}); | ||
}); | ||
}); |
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