Skip to content

Commit a91b341

Browse files
Merge branch 'master' into security/support-deprecated-roles
2 parents fa1b3c1 + 841e64e commit a91b341

46 files changed

Lines changed: 607 additions & 875 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/cli/serve/integration_tests/reload_logging_config.test.ts

Lines changed: 156 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -84,180 +84,174 @@ function createConfigManager(configPath: string) {
8484
}
8585

8686
describe('Server logging configuration', function() {
87-
let child: Child.ChildProcess;
87+
let child: undefined | Child.ChildProcess;
88+
8889
beforeEach(() => {
8990
Fs.mkdirSync(tempDir, { recursive: true });
9091
});
9192

9293
afterEach(async () => {
9394
if (child !== undefined) {
94-
child.kill();
95-
// wait for child to be killed otherwise jest complains that process not finished
96-
await new Promise(res => setTimeout(res, 1000));
95+
const exitPromise = new Promise(resolve => child?.once('exit', resolve));
96+
child.kill('SIGKILL');
97+
await exitPromise;
9798
}
99+
98100
Del.sync(tempDir, { force: true });
99101
});
100102

101-
const isWindows = /^win/.test(process.platform);
102-
if (isWindows) {
103+
if (process.platform.startsWith('win')) {
103104
it('SIGHUP is not a feature of Windows.', () => {
104105
// nothing to do for Windows
105106
});
106-
} else {
107-
describe('legacy logging', () => {
108-
it(
109-
'should be reloadable via SIGHUP process signaling',
110-
async function() {
111-
const configFilePath = Path.resolve(tempDir, 'kibana.yml');
112-
Fs.copyFileSync(legacyConfig, configFilePath);
113-
114-
child = Child.spawn(process.execPath, [
115-
kibanaPath,
116-
'--oss',
117-
'--config',
118-
configFilePath,
119-
'--verbose',
120-
]);
121-
122-
const message$ = Rx.fromEvent(child.stdout, 'data').pipe(
123-
map(messages =>
124-
String(messages)
125-
.split('\n')
126-
.filter(Boolean)
127-
)
128-
);
129-
130-
await message$
131-
.pipe(
132-
// We know the sighup handler will be registered before this message logged
133-
filter(messages => messages.some(m => m.includes('setting up root'))),
134-
take(1)
135-
)
136-
.toPromise();
137-
138-
const lastMessage = await message$.pipe(take(1)).toPromise();
139-
expect(containsJsonOnly(lastMessage)).toBe(true);
140-
141-
createConfigManager(configFilePath).modify(oldConfig => {
142-
oldConfig.logging.json = false;
143-
return oldConfig;
144-
});
145-
146-
child.kill('SIGHUP');
147-
148-
await message$
149-
.pipe(
150-
filter(messages => !containsJsonOnly(messages)),
151-
take(1)
152-
)
153-
.toPromise();
154-
},
155-
minute
156-
);
157-
158-
it(
159-
'should recreate file handle on SIGHUP',
160-
async function() {
161-
const logPath = Path.resolve(tempDir, 'kibana.log');
162-
const logPathArchived = Path.resolve(tempDir, 'kibana_archive.log');
163-
164-
child = Child.spawn(process.execPath, [
165-
kibanaPath,
166-
'--oss',
167-
'--config',
168-
legacyConfig,
169-
'--logging.dest',
170-
logPath,
171-
'--verbose',
172-
]);
173-
174-
await watchFileUntil(logPath, /setting up root/, 30 * second);
175-
// once the server is running, archive the log file and issue SIGHUP
176-
Fs.renameSync(logPath, logPathArchived);
177-
child.kill('SIGHUP');
178-
179-
await watchFileUntil(
180-
logPath,
181-
/Reloaded logging configuration due to SIGHUP/,
182-
30 * second
183-
);
184-
},
185-
minute
186-
);
187-
});
188-
189-
describe('platform logging', () => {
190-
it(
191-
'should be reloadable via SIGHUP process signaling',
192-
async function() {
193-
const configFilePath = Path.resolve(tempDir, 'kibana.yml');
194-
Fs.copyFileSync(configFileLogConsole, configFilePath);
195-
196-
child = Child.spawn(process.execPath, [kibanaPath, '--oss', '--config', configFilePath]);
197-
198-
const message$ = Rx.fromEvent(child.stdout, 'data').pipe(
199-
map(messages =>
200-
String(messages)
201-
.split('\n')
202-
.filter(Boolean)
203-
)
204-
);
205-
206-
await message$
207-
.pipe(
208-
// We know the sighup handler will be registered before this message logged
209-
filter(messages => messages.some(m => m.includes('setting up root'))),
210-
take(1)
211-
)
212-
.toPromise();
213-
214-
const lastMessage = await message$.pipe(take(1)).toPromise();
215-
expect(containsJsonOnly(lastMessage)).toBe(true);
216-
217-
createConfigManager(configFilePath).modify(oldConfig => {
218-
oldConfig.logging.appenders.console.layout.kind = 'pattern';
219-
return oldConfig;
220-
});
221-
child.kill('SIGHUP');
222-
223-
await message$
224-
.pipe(
225-
filter(messages => !containsJsonOnly(messages)),
226-
take(1)
227-
)
228-
.toPromise();
229-
},
230-
30 * second
231-
);
232-
it(
233-
'should recreate file handle on SIGHUP',
234-
async function() {
235-
const configFilePath = Path.resolve(tempDir, 'kibana.yml');
236-
Fs.copyFileSync(configFileLogFile, configFilePath);
237-
238-
const logPath = Path.resolve(tempDir, 'kibana.log');
239-
const logPathArchived = Path.resolve(tempDir, 'kibana_archive.log');
240-
241-
createConfigManager(configFilePath).modify(oldConfig => {
242-
oldConfig.logging.appenders.file.path = logPath;
243-
return oldConfig;
244-
});
245-
246-
child = Child.spawn(process.execPath, [kibanaPath, '--oss', '--config', configFilePath]);
247-
248-
await watchFileUntil(logPath, /setting up root/, 30 * second);
249-
// once the server is running, archive the log file and issue SIGHUP
250-
Fs.renameSync(logPath, logPathArchived);
251-
child.kill('SIGHUP');
252-
253-
await watchFileUntil(
254-
logPath,
255-
/Reloaded logging configuration due to SIGHUP/,
256-
30 * second
257-
);
258-
},
259-
minute
260-
);
261-
});
107+
return;
262108
}
109+
110+
describe('legacy logging', () => {
111+
it(
112+
'should be reloadable via SIGHUP process signaling',
113+
async function() {
114+
const configFilePath = Path.resolve(tempDir, 'kibana.yml');
115+
Fs.copyFileSync(legacyConfig, configFilePath);
116+
117+
child = Child.spawn(process.execPath, [
118+
kibanaPath,
119+
'--oss',
120+
'--config',
121+
configFilePath,
122+
'--verbose',
123+
]);
124+
125+
const message$ = Rx.fromEvent(child.stdout, 'data').pipe(
126+
map(messages =>
127+
String(messages)
128+
.split('\n')
129+
.filter(Boolean)
130+
)
131+
);
132+
133+
await message$
134+
.pipe(
135+
// We know the sighup handler will be registered before this message logged
136+
filter(messages => messages.some(m => m.includes('setting up root'))),
137+
take(1)
138+
)
139+
.toPromise();
140+
141+
const lastMessage = await message$.pipe(take(1)).toPromise();
142+
expect(containsJsonOnly(lastMessage)).toBe(true);
143+
144+
createConfigManager(configFilePath).modify(oldConfig => {
145+
oldConfig.logging.json = false;
146+
return oldConfig;
147+
});
148+
149+
child.kill('SIGHUP');
150+
151+
await message$
152+
.pipe(
153+
filter(messages => !containsJsonOnly(messages)),
154+
take(1)
155+
)
156+
.toPromise();
157+
},
158+
minute
159+
);
160+
161+
it(
162+
'should recreate file handle on SIGHUP',
163+
async function() {
164+
const logPath = Path.resolve(tempDir, 'kibana.log');
165+
const logPathArchived = Path.resolve(tempDir, 'kibana_archive.log');
166+
167+
child = Child.spawn(process.execPath, [
168+
kibanaPath,
169+
'--oss',
170+
'--config',
171+
legacyConfig,
172+
'--logging.dest',
173+
logPath,
174+
'--verbose',
175+
]);
176+
177+
await watchFileUntil(logPath, /setting up root/, 30 * second);
178+
// once the server is running, archive the log file and issue SIGHUP
179+
Fs.renameSync(logPath, logPathArchived);
180+
child.kill('SIGHUP');
181+
182+
await watchFileUntil(logPath, /Reloaded logging configuration due to SIGHUP/, 30 * second);
183+
},
184+
minute
185+
);
186+
});
187+
188+
describe('platform logging', () => {
189+
it(
190+
'should be reloadable via SIGHUP process signaling',
191+
async function() {
192+
const configFilePath = Path.resolve(tempDir, 'kibana.yml');
193+
Fs.copyFileSync(configFileLogConsole, configFilePath);
194+
195+
child = Child.spawn(process.execPath, [kibanaPath, '--oss', '--config', configFilePath]);
196+
197+
const message$ = Rx.fromEvent(child.stdout, 'data').pipe(
198+
map(messages =>
199+
String(messages)
200+
.split('\n')
201+
.filter(Boolean)
202+
)
203+
);
204+
205+
await message$
206+
.pipe(
207+
// We know the sighup handler will be registered before this message logged
208+
filter(messages => messages.some(m => m.includes('setting up root'))),
209+
take(1)
210+
)
211+
.toPromise();
212+
213+
const lastMessage = await message$.pipe(take(1)).toPromise();
214+
expect(containsJsonOnly(lastMessage)).toBe(true);
215+
216+
createConfigManager(configFilePath).modify(oldConfig => {
217+
oldConfig.logging.appenders.console.layout.kind = 'pattern';
218+
return oldConfig;
219+
});
220+
child.kill('SIGHUP');
221+
222+
await message$
223+
.pipe(
224+
filter(messages => !containsJsonOnly(messages)),
225+
take(1)
226+
)
227+
.toPromise();
228+
},
229+
30 * second
230+
);
231+
it(
232+
'should recreate file handle on SIGHUP',
233+
async function() {
234+
const configFilePath = Path.resolve(tempDir, 'kibana.yml');
235+
Fs.copyFileSync(configFileLogFile, configFilePath);
236+
237+
const logPath = Path.resolve(tempDir, 'kibana.log');
238+
const logPathArchived = Path.resolve(tempDir, 'kibana_archive.log');
239+
240+
createConfigManager(configFilePath).modify(oldConfig => {
241+
oldConfig.logging.appenders.file.path = logPath;
242+
return oldConfig;
243+
});
244+
245+
child = Child.spawn(process.execPath, [kibanaPath, '--oss', '--config', configFilePath]);
246+
247+
await watchFileUntil(logPath, /setting up root/, 30 * second);
248+
// once the server is running, archive the log file and issue SIGHUP
249+
Fs.renameSync(logPath, logPathArchived);
250+
child.kill('SIGHUP');
251+
252+
await watchFileUntil(logPath, /Reloaded logging configuration due to SIGHUP/, 30 * second);
253+
},
254+
minute
255+
);
256+
});
263257
});

src/dev/npm/integration_tests/installed_packages.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('src/dev/npm/installed_packages', () => {
4141
includeDev: true,
4242
}),
4343
]);
44-
}, 60 * 1000);
44+
}, 360 * 1000);
4545

4646
it('reads all installed packages of a module', () => {
4747
expect(fixture1Packages).toEqual([

src/legacy/core_plugins/data/public/search/expressions/esaggs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
import { buildTabularInspectorData } from './build_tabular_inspector_data';
4141
import { calculateObjectHash } from '../../../../visualizations/public';
4242
import { tabifyAggResponse } from '../../../../../core_plugins/data/public';
43-
import { PersistedState } from '../../../../../ui/public/persisted_state';
43+
import { PersistedState } from '../../../../../../plugins/visualizations/public';
4444
import { Adapters } from '../../../../../../plugins/inspector/public';
4545
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
4646
import { getQueryService, getIndexPatterns } from '../../../../../../plugins/data/public/services';

src/legacy/core_plugins/kibana/public/visualize/legacy_imports.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export { State } from 'ui/state_management/state';
2929
export { GlobalStateProvider } from 'ui/state_management/global_state';
3030
// @ts-ignore
3131
export { StateManagementConfigProvider } from 'ui/state_management/config_provider';
32-
export { PersistedState } from 'ui/persisted_state';
3332

3433
export { subscribeWithScope } from 'ui/utils/subscribe_with_scope';
3534
// @ts-ignore

src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/make_stateful.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
import { PersistedState } from '../../../legacy_imports';
20+
import { PersistedState } from '../../../../../../../../plugins/visualizations/public';
2121
import { ReduxLikeStateContainer } from '../../../../../../../../plugins/kibana_utils/public';
2222
import { VisualizeAppState, VisualizeAppStateTransitions } from '../../types';
2323

src/legacy/core_plugins/kibana/public/visualize/np_ready/types.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919

2020
import { TimeRange, Query, Filter, DataPublicPluginStart } from 'src/plugins/data/public';
2121
import { IEmbeddableStart } from 'src/plugins/embeddable/public';
22+
import { PersistedState } from 'src/plugins/visualizations/public';
2223
import { LegacyCoreStart } from 'kibana/public';
2324
import { Vis } from 'src/legacy/core_plugins/visualizations/public';
24-
import { VisSavedObject, PersistedState } from '../legacy_imports';
25+
import { VisSavedObject } from '../legacy_imports';
2526

2627
export type PureVisState = ReturnType<Vis['getCurrentState']>;
2728

src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import React, { useMemo, useState, useCallback, KeyboardEventHandler, useEffect
2121
import { get, isEqual } from 'lodash';
2222
import { i18n } from '@kbn/i18n';
2323
import { keyCodes, EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui';
24-
2524
import { Vis } from 'src/legacy/core_plugins/visualizations/public';
26-
import { PersistedState, AggGroupNames } from '../../legacy_imports';
25+
import { AggGroupNames } from '../../legacy_imports';
2726
import { DefaultEditorNavBar, OptionTab } from './navbar';
2827
import { DefaultEditorControls } from './controls';
2928
import { setStateParamValue, useEditorReducer, useEditorFormState, discardChanges } from './state';
3029
import { DefaultEditorAggCommonProps } from '../agg_common_props';
30+
import { PersistedState } from '../../../../../../plugins/visualizations/public';
3131

3232
interface DefaultEditorSideBarProps {
3333
isCollapsed: boolean;

0 commit comments

Comments
 (0)