Skip to content

Commit cea6143

Browse files
Merge branch 'master' into more-slack-alerts
2 parents a78f5c7 + 8652bed commit cea6143

7 files changed

Lines changed: 77 additions & 46 deletions

File tree

packages/kbn-es/src/utils/native_realm.js

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ exports.NativeRealm = class NativeRealm {
7676
}
7777

7878
const reservedUsers = await this.getReservedUsers();
79-
if (!reservedUsers || reservedUsers.length < 1) {
80-
throw new Error('no reserved users found, unable to set native realm passwords');
81-
}
82-
8379
await Promise.all(
8480
reservedUsers.map(async user => {
8581
await this.setPassword(user, options[`password.${user}`]);
@@ -88,16 +84,18 @@ exports.NativeRealm = class NativeRealm {
8884
}
8985

9086
async getReservedUsers() {
91-
const users = await this._autoRetry(async () => {
92-
return await this._client.security.getUser();
93-
});
87+
return await this._autoRetry(async () => {
88+
const resp = await this._client.security.getUser();
89+
const usernames = Object.keys(resp.body).filter(
90+
user => resp.body[user].metadata._reserved === true
91+
);
9492

95-
return Object.keys(users.body).reduce((acc, user) => {
96-
if (users.body[user].metadata._reserved === true) {
97-
acc.push(user);
93+
if (!usernames?.length) {
94+
throw new Error('no reserved users found, unable to set native realm passwords');
9895
}
99-
return acc;
100-
}, []);
96+
97+
return usernames;
98+
});
10199
}
102100

103101
async isSecurityEnabled() {
@@ -125,10 +123,9 @@ exports.NativeRealm = class NativeRealm {
125123
throw error;
126124
}
127125

128-
this._log.warning(
129-
'assuming [elastic] user not available yet, waiting 1.5 seconds and trying again'
130-
);
131-
await new Promise(resolve => setTimeout(resolve, 1500));
126+
const sec = 1.5 * attempt;
127+
this._log.warning(`assuming ES isn't initialized completely, trying again in ${sec} seconds`);
128+
await new Promise(resolve => setTimeout(resolve, sec * 1000));
132129
return await this._autoRetry(fn, attempt + 1);
133130
}
134131
}

test/functional/apps/visualize/_tsvb_chart.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
2828
const security = getService('security');
2929
const PageObjects = getPageObjects(['visualize', 'visualBuilder', 'timePicker', 'visChart']);
3030

31-
describe('visual builder', function describeIndexTests() {
31+
// FLAKY: https://github.com/elastic/kibana/issues/43150
32+
describe.skip('visual builder', function describeIndexTests() {
3233
this.tags('includeFirefox');
3334
beforeEach(async () => {
3435
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);

x-pack/plugins/lens/public/app_plugin/app.test.tsx

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ describe('Lens App', () => {
104104
storage: Storage;
105105
docId?: string;
106106
docStorage: SavedObjectStore;
107-
redirectTo: (id?: string, returnToOrigin?: boolean, newlyCreated?: boolean) => void;
107+
redirectTo: (
108+
id?: string,
109+
returnToOrigin?: boolean,
110+
originatingApp?: string | undefined,
111+
newlyCreated?: boolean
112+
) => void;
108113
originatingApp: string | undefined;
109114
}> {
110115
return ({
@@ -140,7 +145,14 @@ describe('Lens App', () => {
140145
load: jest.fn(),
141146
save: jest.fn(),
142147
},
143-
redirectTo: jest.fn((id?: string, returnToOrigin?: boolean, newlyCreated?: boolean) => {}),
148+
redirectTo: jest.fn(
149+
(
150+
id?: string,
151+
returnToOrigin?: boolean,
152+
originatingApp?: string | undefined,
153+
newlyCreated?: boolean
154+
) => {}
155+
),
144156
} as unknown) as jest.Mocked<{
145157
navigation: typeof navigationStartMock;
146158
editorFrame: EditorFrameInstance;
@@ -149,7 +161,12 @@ describe('Lens App', () => {
149161
storage: Storage;
150162
docId?: string;
151163
docStorage: SavedObjectStore;
152-
redirectTo: (id?: string, returnToOrigin?: boolean, newlyCreated?: boolean) => void;
164+
redirectTo: (
165+
id?: string,
166+
returnToOrigin?: boolean,
167+
originatingApp?: string | undefined,
168+
newlyCreated?: boolean
169+
) => void;
153170
originatingApp: string | undefined;
154171
}>;
155172
}
@@ -348,7 +365,12 @@ describe('Lens App', () => {
348365
storage: Storage;
349366
docId?: string;
350367
docStorage: SavedObjectStore;
351-
redirectTo: (id?: string, returnToOrigin?: boolean, newlyCreated?: boolean) => void;
368+
redirectTo: (
369+
id?: string,
370+
returnToOrigin?: boolean,
371+
originatingApp?: string | undefined,
372+
newlyCreated?: boolean
373+
) => void;
352374
originatingApp: string | undefined;
353375
}>;
354376

@@ -521,7 +543,7 @@ describe('Lens App', () => {
521543
expression: 'kibana 3',
522544
});
523545

524-
expect(args.redirectTo).toHaveBeenCalledWith('aaa', undefined, true);
546+
expect(args.redirectTo).toHaveBeenCalledWith('aaa', undefined, undefined, true);
525547

526548
inst.setProps({ docId: 'aaa' });
527549

@@ -541,7 +563,7 @@ describe('Lens App', () => {
541563
expression: 'kibana 3',
542564
});
543565

544-
expect(args.redirectTo).toHaveBeenCalledWith('aaa', undefined, true);
566+
expect(args.redirectTo).toHaveBeenCalledWith('aaa', undefined, undefined, true);
545567

546568
inst.setProps({ docId: 'aaa' });
547569

@@ -609,7 +631,7 @@ describe('Lens App', () => {
609631
title: 'hello there',
610632
});
611633

612-
expect(args.redirectTo).toHaveBeenCalledWith('aaa', true, true);
634+
expect(args.redirectTo).toHaveBeenCalledWith('aaa', true, undefined, true);
613635
});
614636

615637
it('saves app filters and does not save pinned filters', async () => {
@@ -677,7 +699,12 @@ describe('Lens App', () => {
677699
storage: Storage;
678700
docId?: string;
679701
docStorage: SavedObjectStore;
680-
redirectTo: (id?: string, returnToOrigin?: boolean, newlyCreated?: boolean) => void;
702+
redirectTo: (
703+
id?: string,
704+
returnToOrigin?: boolean,
705+
originatingApp?: string | undefined,
706+
newlyCreated?: boolean
707+
) => void;
681708
}>;
682709

683710
beforeEach(() => {

x-pack/plugins/lens/public/app_plugin/app.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ interface State {
3333
isLoading: boolean;
3434
isSaveModalVisible: boolean;
3535
indexPatternsForTopNav: IndexPatternInstance[];
36+
originatingApp: string | undefined;
3637
persistedDoc?: Document;
3738
lastKnownDoc?: Document;
3839

@@ -54,7 +55,7 @@ export function App({
5455
docId,
5556
docStorage,
5657
redirectTo,
57-
originatingApp,
58+
originatingAppFromUrl,
5859
navigation,
5960
}: {
6061
editorFrame: EditorFrameInstance;
@@ -64,8 +65,13 @@ export function App({
6465
storage: IStorageWrapper;
6566
docId?: string;
6667
docStorage: SavedObjectStore;
67-
redirectTo: (id?: string, returnToOrigin?: boolean, newlyCreated?: boolean) => void;
68-
originatingApp?: string | undefined;
68+
redirectTo: (
69+
id?: string,
70+
returnToOrigin?: boolean,
71+
originatingApp?: string | undefined,
72+
newlyCreated?: boolean
73+
) => void;
74+
originatingAppFromUrl?: string | undefined;
6975
}) {
7076
const language =
7177
storage.get('kibana.userQueryLanguage') || core.uiSettings.get('search:queryLanguage');
@@ -77,6 +83,7 @@ export function App({
7783
isSaveModalVisible: false,
7884
indexPatternsForTopNav: [],
7985
query: { query: '', language },
86+
originatingApp: originatingAppFromUrl,
8087
dateRange: {
8188
fromDate: currentRange.from,
8289
toDate: currentRange.to,
@@ -229,7 +236,7 @@ export function App({
229236
lastKnownDoc: newDoc,
230237
}));
231238
if (docId !== id || saveProps.returnToOrigin) {
232-
redirectTo(id, saveProps.returnToOrigin, newlyCreated);
239+
redirectTo(id, saveProps.returnToOrigin, state.originatingApp, newlyCreated);
233240
}
234241
})
235242
.catch(e => {
@@ -269,7 +276,7 @@ export function App({
269276
<div className="lnsApp__header">
270277
<TopNavMenu
271278
config={[
272-
...(!!originatingApp && lastKnownDoc?.id
279+
...(!!state.originatingApp && lastKnownDoc?.id
273280
? [
274281
{
275282
label: i18n.translate('xpack.lens.app.saveAndReturn', {
@@ -294,14 +301,14 @@ export function App({
294301
: []),
295302
{
296303
label:
297-
lastKnownDoc?.id && !!originatingApp
304+
lastKnownDoc?.id && !!state.originatingApp
298305
? i18n.translate('xpack.lens.app.saveAs', {
299306
defaultMessage: 'Save as',
300307
})
301308
: i18n.translate('xpack.lens.app.save', {
302309
defaultMessage: 'Save',
303310
}),
304-
emphasize: !originatingApp || !lastKnownDoc?.id,
311+
emphasize: !state.originatingApp || !lastKnownDoc?.id,
305312
run: () => {
306313
if (isSaveable && lastKnownDoc) {
307314
setState(s => ({ ...s, isSaveModalVisible: true }));
@@ -422,7 +429,7 @@ export function App({
422429
</div>
423430
{lastKnownDoc && state.isSaveModalVisible && (
424431
<SavedObjectSaveModalOrigin
425-
originatingApp={originatingApp}
432+
originatingApp={state.originatingApp}
426433
onSave={props => runSave(props)}
427434
onClose={() => setState(s => ({ ...s, isSaveModalVisible: false }))}
428435
documentInfo={{

x-pack/plugins/lens/public/app_plugin/mounter.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,11 @@ export async function mountApp(
4747
);
4848
const redirectTo = (
4949
routeProps: RouteComponentProps<{ id?: string }>,
50-
originatingApp: string,
5150
id?: string,
5251
returnToOrigin?: boolean,
52+
originatingApp?: string,
5353
newlyCreated?: boolean
5454
) => {
55-
if (!!originatingApp && !returnToOrigin) {
56-
removeQueryParam(routeProps.history, 'embeddableOriginatingApp');
57-
}
58-
5955
if (!id) {
6056
routeProps.history.push('/');
6157
} else if (!originatingApp) {
@@ -78,7 +74,10 @@ export async function mountApp(
7874
const renderEditor = (routeProps: RouteComponentProps<{ id?: string }>) => {
7975
trackUiEvent('loaded');
8076
const urlParams = parse(routeProps.location.search) as Record<string, string>;
81-
const originatingApp = urlParams.embeddableOriginatingApp;
77+
const originatingAppFromUrl = urlParams.embeddableOriginatingApp;
78+
if (urlParams.embeddableOriginatingApp) {
79+
removeQueryParam(routeProps.history, 'embeddableOriginatingApp');
80+
}
8281

8382
return (
8483
<App
@@ -89,10 +88,10 @@ export async function mountApp(
8988
storage={new Storage(localStorage)}
9089
docId={routeProps.match.params.id}
9190
docStorage={new SavedObjectIndexStore(savedObjectsClient)}
92-
redirectTo={(id, returnToOrigin, newlyCreated) =>
93-
redirectTo(routeProps, originatingApp, id, returnToOrigin, newlyCreated)
91+
redirectTo={(id, returnToOrigin, originatingApp, newlyCreated) =>
92+
redirectTo(routeProps, id, returnToOrigin, originatingApp, newlyCreated)
9493
}
95-
originatingApp={originatingApp}
94+
originatingAppFromUrl={originatingAppFromUrl}
9695
/>
9796
);
9897
};

x-pack/test/functional/apps/dashboard/_async_dashboard.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
2626
'timePicker',
2727
]);
2828

29-
// FLAKY: https://github.com/elastic/kibana/issues/65949
30-
describe.skip('sample data dashboard', function describeIndexTests() {
29+
describe('sample data dashboard', function describeIndexTests() {
3130
before(async () => {
3231
await PageObjects.common.sleep(5000);
3332
await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', {

x-pack/test/functional_endpoint/apps/endpoint/policy_list.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
1212
const testSubjects = getService('testSubjects');
1313
const policyTestResources = getService('policyTestResources');
1414

15-
describe('When on the Endpoint Policy List', function() {
15+
// FLAKY: https://github.com/elastic/kibana/issues/66579
16+
describe.skip('When on the Endpoint Policy List', function() {
1617
this.tags(['ciGroup7']);
1718
before(async () => {
1819
await pageObjects.common.navigateToUrlWithBrowserHistory('endpoint', '/policy');
@@ -46,7 +47,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
4647
expect(noItemsFoundMessage).to.equal('No items found');
4748
});
4849

49-
describe('and policies exists', () => {
50+
xdescribe('and policies exists', () => {
5051
let policyInfo: PolicyTestResourceInfo;
5152

5253
before(async () => {

0 commit comments

Comments
 (0)