mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Turn on deprecation logs in Jest integration tests (#199095)
## Summary Part of preparing for 9.0 release we monitor test logs to surface deprecated ES usage in Kibana. This PR ensures that all Jest integration test are surfacing these logs by default.
This commit is contained in:
parent
9f514f641d
commit
3c976c0b93
3 changed files with 43 additions and 7 deletions
|
@ -43,6 +43,22 @@ const DEFAULTS_SETTINGS = {
|
|||
root: {
|
||||
level: 'off',
|
||||
},
|
||||
loggers: [
|
||||
{
|
||||
name: 'root',
|
||||
level: 'error',
|
||||
appenders: ['console'],
|
||||
},
|
||||
{
|
||||
name: 'elasticsearch.deprecation',
|
||||
level: 'all',
|
||||
appenders: ['deprecation'],
|
||||
},
|
||||
],
|
||||
appenders: {
|
||||
deprecation: { type: 'console', layout: { type: 'json' } },
|
||||
console: { type: 'console', layout: { type: 'pattern' } },
|
||||
},
|
||||
},
|
||||
plugins: {},
|
||||
migrations: { skip: false },
|
||||
|
|
|
@ -28,11 +28,28 @@ describe('request logging', () => {
|
|||
|
||||
describe('http server response logging', () => {
|
||||
describe('configuration', () => {
|
||||
let root: ReturnType<typeof createRoot>;
|
||||
|
||||
afterEach(async () => {
|
||||
await root?.shutdown();
|
||||
});
|
||||
it('does not log with a default config', async () => {
|
||||
const root = createRoot({
|
||||
root = createRoot({
|
||||
plugins: { initialize: false },
|
||||
elasticsearch: { skipStartupConnectionCheck: true },
|
||||
server: { restrictInternalApis: false },
|
||||
logging: {
|
||||
appenders: {
|
||||
'test-console': { type: 'console', layout: { type: 'json' } },
|
||||
},
|
||||
loggers: [
|
||||
{
|
||||
name: 'http.server.response',
|
||||
appenders: ['test-console'],
|
||||
level: 'off',
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
await root.preboot();
|
||||
const { http } = await root.setup();
|
||||
|
@ -47,12 +64,10 @@ describe('request logging', () => {
|
|||
|
||||
await request.get(root, '/ping').expect(200, 'pong');
|
||||
expect(mockConsoleLog).not.toHaveBeenCalled();
|
||||
|
||||
await root.shutdown();
|
||||
});
|
||||
|
||||
it('logs at the correct level and with the correct context', async () => {
|
||||
const root = createRoot({
|
||||
root = createRoot({
|
||||
logging: {
|
||||
appenders: {
|
||||
'test-console': {
|
||||
|
@ -93,8 +108,6 @@ describe('request logging', () => {
|
|||
const [level, logger] = mockConsoleLog.mock.calls[0][0].split('|');
|
||||
expect(level).toBe('DEBUG');
|
||||
expect(logger).toBe('http.server.response');
|
||||
|
||||
await root.shutdown();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -131,7 +144,7 @@ describe('request logging', () => {
|
|||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await root.shutdown();
|
||||
await root?.shutdown();
|
||||
});
|
||||
|
||||
it('handles a GET request', async () => {
|
||||
|
|
|
@ -16,6 +16,13 @@ function createRootWithRoles(roles: string[]) {
|
|||
roles,
|
||||
},
|
||||
logging: {
|
||||
loggers: [
|
||||
{
|
||||
name: 'root',
|
||||
appenders: ['test-console'],
|
||||
level: 'info',
|
||||
},
|
||||
],
|
||||
appenders: {
|
||||
'test-console': {
|
||||
type: 'console',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue