-
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.
[Endpoint][EPM] Endpoint depending on ingest manager to initialize (#…
…62871) (#63148) * Endpoint successfully depending on ingest manager to initialize * Moving the endpoint functional tests to their own directory to avoid enabling ingest in the base tests * Removing page objects and other endpoint fields from base functional * Updating code owners with new functional location * Pointing resolver tests at endpoint functional tests * Pointing space tests at the endpoint functional directory * Adding jest test names
- Loading branch information
1 parent
e34cf6c
commit 9701d52
Showing
30 changed files
with
236 additions
and
15 deletions.
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
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
52 changes: 52 additions & 0 deletions
52
x-pack/plugins/endpoint/public/applications/endpoint/view/setup.tsx
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,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; | ||
}; |
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
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,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', | ||
], | ||
}, | ||
}; | ||
} |
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,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>; |
File renamed without changes.
File renamed without changes.
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,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, | ||
}; |
14 changes: 14 additions & 0 deletions
14
x-pack/test/functional_endpoint_ingest_failure/apps/endpoint/index.ts
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,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')); | ||
}); | ||
} |
22 changes: 22 additions & 0 deletions
22
x-pack/test/functional_endpoint_ingest_failure/apps/endpoint/landing_page.ts
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,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'); | ||
}); | ||
}); | ||
}; |
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,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', | ||
], | ||
}, | ||
}; | ||
} |
Oops, something went wrong.