-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Endpoint][EPM] Endpoint depending on ingest manager to initialize #62871
Changes from all commits
b69c2ad
7c7eaee
c9f0507
b82762b
cb45dfe
a1f2bd0
f13231a
745c15d
661f860
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* 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 * as React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { NotificationsStart } from 'kibana/public'; | ||
import { IngestManagerStart } from '../../../../../ingest_manager/public'; | ||
|
||
export const Setup: React.FunctionComponent<{ | ||
ingestManager: IngestManagerStart; | ||
notifications: NotificationsStart; | ||
}> = ({ ingestManager, notifications }) => { | ||
React.useEffect(() => { | ||
const defaultText = i18n.translate('xpack.endpoint.ingestToastMessage', { | ||
defaultMessage: 'Ingest Manager failed during its setup.', | ||
}); | ||
|
||
const title = i18n.translate('xpack.endpoint.ingestToastTitle', { | ||
defaultMessage: 'App failed to initialize', | ||
}); | ||
|
||
const displayToastWithModal = (text: string) => { | ||
const errorText = new Error(defaultText); | ||
// we're leveraging the notification's error toast which is usually used for displaying stack traces of an | ||
// actually Error. Instead of displaying a stack trace we'll display the more detailed error text when the | ||
// user clicks `See the full error` button to see the modal | ||
errorText.stack = text; | ||
notifications.toasts.addError(errorText, { | ||
title, | ||
}); | ||
}; | ||
|
||
const displayToast = () => { | ||
notifications.toasts.addDanger({ | ||
title, | ||
text: defaultText, | ||
}); | ||
}; | ||
|
||
if (!ingestManager.success) { | ||
if (ingestManager.error) { | ||
displayToastWithModal(ingestManager.error.message); | ||
} else { | ||
displayToast(); | ||
} | ||
} | ||
}, [ingestManager, notifications.toasts]); | ||
|
||
return null; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,6 +252,7 @@ export enum IngestAssetType { | |
export enum DefaultPackages { | ||
base = 'base', | ||
system = 'system', | ||
endpoint = 'endpoint', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Installing the endpoint package by default There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @mostlyjason |
||
} | ||
|
||
export interface IndexTemplate { | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -43,6 +43,8 @@ const onlyNotInCoverageTests = [ | |||||||||||
require.resolve('../test/licensing_plugin/config.ts'), | ||||||||||||
require.resolve('../test/licensing_plugin/config.public.ts'), | ||||||||||||
require.resolve('../test/licensing_plugin/config.legacy.ts'), | ||||||||||||
require.resolve('../test/functional_endpoint_ingest_failure/config.ts'), | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @oatkiller @kqualters-elastic @jfsiii Any ideas if this needs to be here when we add new testing directories? @jfsiii I didn't see the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jonathan-buttner I'm not sure. Perhaps someone from @elastic/kibana-platform or @elastic/kibana-operations can help? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This script is currently run with the kibana/test/scripts/jenkins_xpack_ci_group.sh Lines 8 to 12 in f84773f
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah thanks @spalger ! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there was a little confusion here. I think we want the endpoint functional UI tests in these 2 paths;
to be in the |
||||||||||||
require.resolve('../test/functional_endpoint/config.ts'), | ||||||||||||
]; | ||||||||||||
|
||||||||||||
require('@kbn/plugin-helpers').babelRegister(); | ||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -389,7 +389,8 @@ | |
"type": "nested" | ||
}, | ||
"file_extension": { | ||
"type": "long" | ||
"ignore_above": 1024, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was conflicting with the mapping installed by the Endpoint package. The file_extension should be a string, not a long. |
||
"type": "keyword" | ||
}, | ||
"project_file": { | ||
"properties": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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 { resolve } from 'path'; | ||
import { FtrConfigProviderContext } from '@kbn/test/types/ftr'; | ||
import { pageObjects } from './page_objects'; | ||
|
||
export default async function({ readConfigFile }: FtrConfigProviderContext) { | ||
const xpackFunctionalConfig = await readConfigFile(require.resolve('../functional/config.js')); | ||
|
||
return { | ||
...xpackFunctionalConfig.getAll(), | ||
pageObjects, | ||
testFiles: [resolve(__dirname, './apps/endpoint')], | ||
junit: { | ||
reportName: 'X-Pack Endpoint Functional Tests', | ||
}, | ||
apps: { | ||
...xpackFunctionalConfig.get('apps'), | ||
endpoint: { | ||
pathname: '/app/endpoint', | ||
}, | ||
}, | ||
kbnTestServer: { | ||
...xpackFunctionalConfig.get('kbnTestServer'), | ||
serverArgs: [ | ||
...xpackFunctionalConfig.get('kbnTestServer.serverArgs'), | ||
'--xpack.endpoint.enabled=true', | ||
'--xpack.ingestManager.enabled=true', | ||
'--xpack.ingestManager.fleet.enabled=true', | ||
], | ||
}, | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* 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 { GenericFtrProviderContext } from '@kbn/test/types/ftr'; | ||
|
||
import { pageObjects } from './page_objects'; | ||
import { services } from '../functional/services'; | ||
|
||
export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* 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 { pageObjects as xpackFunctionalPageObjects } from '../../functional/page_objects'; | ||
import { EndpointPageProvider } from './endpoint_page'; | ||
import { EndpointAlertsPageProvider } from './endpoint_alerts_page'; | ||
|
||
export const pageObjects = { | ||
...xpackFunctionalPageObjects, | ||
endpoint: EndpointPageProvider, | ||
endpointAlerts: EndpointAlertsPageProvider, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* 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 { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function({ loadTestFile }: FtrProviderContext) { | ||
describe('endpoint when the ingest manager fails to setup correctly', function() { | ||
this.tags('ciGroup7'); | ||
|
||
loadTestFile(require.resolve('./landing_page')); | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* 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 { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default ({ getPageObjects, getService }: FtrProviderContext) => { | ||
describe('home page', function() { | ||
const pageObjects = getPageObjects(['common']); | ||
const testSubjects = getService('testSubjects'); | ||
|
||
before(async () => { | ||
await pageObjects.common.navigateToApp('endpoint'); | ||
}); | ||
|
||
it('displays an error toast', async () => { | ||
await testSubjects.existOrFail('euiToastHeader'); | ||
}); | ||
}); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* 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 { resolve } from 'path'; | ||
import { FtrConfigProviderContext } from '@kbn/test/types/ftr'; | ||
|
||
export default async function({ readConfigFile }: FtrConfigProviderContext) { | ||
const xpackFunctionalConfig = await readConfigFile( | ||
require.resolve('../functional_endpoint/config.ts') | ||
); | ||
|
||
return { | ||
...xpackFunctionalConfig.getAll(), | ||
testFiles: [resolve(__dirname, './apps/endpoint')], | ||
junit: { | ||
reportName: 'X-Pack Endpoint Without Ingest Functional Tests', | ||
}, | ||
kbnTestServer: { | ||
...xpackFunctionalConfig.get('kbnTestServer'), | ||
serverArgs: [ | ||
...xpackFunctionalConfig.get('kbnTestServer.serverArgs'), | ||
// use a bogus port so the ingest manager setup will fail | ||
'--xpack.ingestManager.epm.registryUrl=http://127.0.0.1:12345', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding an invalid URL to trigger the toast for the functional test. |
||
], | ||
}, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ Where is the "see the full error" message? The two I see here are:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The full error message is returned by the ingest manager app, it's just below these lines
ingestManager.error.message