Skip to content

Commit

Permalink
Merge branch 'master' into unskip-flaky-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Feb 18, 2020
2 parents e380bfd + bca0d1c commit a90ebe6
Show file tree
Hide file tree
Showing 216 changed files with 3,770 additions and 2,303 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,15 @@
# Kibana Alerting Services
/x-pack/legacy/plugins/alerting/ @elastic/kibana-alerting-services
/x-pack/legacy/plugins/actions/ @elastic/kibana-alerting-services
/x-pack/plugins/alerting/ @elastic/kibana-alerting-services
/x-pack/plugins/actions/ @elastic/kibana-alerting-services
/x-pack/plugins/event_log/ @elastic/kibana-alerting-services
/x-pack/plugins/task_manager/ @elastic/kibana-alerting-services
/x-pack/test/alerting_api_integration/ @elastic/kibana-alerting-services
/x-pack/test/plugin_api_integration/plugins/task_manager/ @elastic/kibana-alerting-services
/x-pack/test/plugin_api_integration/test_suites/task_manager/ @elastic/kibana-alerting-services
/x-pack/legacy/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/ @elastic/kibana-alerting-services

Expand Down
8 changes: 4 additions & 4 deletions docs/api/dashboard/import-dashboard.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ experimental[] Import dashboards and corresponding saved objects.

`force`::
(Optional, boolean) Overwrite any existing objects on ID conflict.

`exclude`::
(Optional, array) Saved object types that you want to exclude from the import.

Expand All @@ -28,14 +28,14 @@ Use the complete response body from the <<dashboard-api-export, Export dashboard
[[dashboard-api-import-response-body]]
==== Response body

`objects`::
(array) A top level property that includes the saved objects.
`objects`::
(array) A top level property that includes the saved objects.

[[dashboard-api-import-codes]]
==== Response code

`200`::
Indicates a successful call, even if there are errors importing individual saved objects. If there ar errors, the error information is returned in the response body on an object-by-object basis.
Indicates a successful call, even if there are errors importing individual saved objects. If there are errors, the error information is returned in the response body on an object-by-object basis.

[[dashboard-api-import-example]]
==== Example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const MOCK_REPO_DIR = Path.resolve(TMP_DIR, 'mock_repo');

expect.addSnapshotSerializer(createAbsolutePathSerializer(MOCK_REPO_DIR));

beforeEach(async () => {
beforeAll(async () => {
await del(TMP_DIR);
await cpy('**/*', MOCK_REPO_DIR, {
cwd: MOCK_REPO_SRC,
Expand All @@ -42,7 +42,7 @@ beforeEach(async () => {
});
});

afterEach(async () => {
afterAll(async () => {
await del(TMP_DIR);
});

Expand Down Expand Up @@ -153,3 +153,32 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
]
`);
});

it('uses cache on second run and exist cleanly', async () => {
const config = OptimizerConfig.create({
repoRoot: MOCK_REPO_DIR,
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
maxWorkerCount: 1,
});

const msgs = await runOptimizer(config)
.pipe(
tap(state => {
if (state.event?.type === 'worker stdio') {
// eslint-disable-next-line no-console
console.log('worker', state.event.stream, state.event.chunk.toString('utf8'));
}
}),
toArray()
)
.toPromise();

expect(msgs.map(m => m.state.phase)).toMatchInlineSnapshot(`
Array [
"initializing",
"initializing",
"initializing",
"initialized",
]
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export function handleOptimizerCompletion(config: OptimizerConfig) {
return;
}

if (prevState?.phase === 'initialized' && prevState.onlineBundles.length === 0) {
// all bundles cached
return;
}

if (prevState?.phase === 'issue') {
throw createFailError('webpack issue');
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1197,8 +1197,8 @@ In server code, `core` can be accessed from either `server.newPlatform` or `kbnS
| `server.route` | [`core.http.createRouter`](/docs/development/core/server/kibana-plugin-server.httpservicesetup.createrouter.md) | [Examples](./MIGRATION_EXAMPLES.md#route-registration) |
| `server.renderApp()` / `server.renderAppWithDefaultConfig()` | [`context.rendering.render()`](/docs/development/core/server/kibana-plugin-server.iscopedrenderingclient.render.md) | [Examples](./MIGRATION_EXAMPLES.md#render-html-content) |
| `request.getBasePath()` | [`core.http.basePath.get`](/docs/development/core/server/kibana-plugin-server.httpservicesetup.basepath.md) | |
| `server.plugins.elasticsearch.getCluster('data')` | [`context.elasticsearch.dataClient`](/docs/development/core/server/kibana-plugin-server.iscopedclusterclient.md) | |
| `server.plugins.elasticsearch.getCluster('admin')` | [`context.elasticsearch.adminClient`](/docs/development/core/server/kibana-plugin-server.iscopedclusterclient.md) | |
| `server.plugins.elasticsearch.getCluster('data')` | [`context.core.elasticsearch.dataClient`](/docs/development/core/server/kibana-plugin-server.iscopedclusterclient.md) | |
| `server.plugins.elasticsearch.getCluster('admin')` | [`context.core.elasticsearch.adminClient`](/docs/development/core/server/kibana-plugin-server.iscopedclusterclient.md) | |
| `server.plugins.elasticsearch.createCluster(...)` | [`core.elasticsearch.createClient`](/docs/development/core/server/kibana-plugin-server.elasticsearchservicesetup.createclient.md) | |
| `server.savedObjects.setScopedSavedObjectsClientFactory` | [`core.savedObjects.setClientFactory`](/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.setclientfactory.md) | |
| `server.savedObjects.addScopedSavedObjectsClientWrapperFactory` | [`core.savedObjects.addClientWrapper`](/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.addclientwrapper.md) | |
Expand Down
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"paths": {
"xpack.actions": "plugins/actions",
"xpack.advancedUiActions": "plugins/advanced_ui_actions",
"xpack.alerting": "legacy/plugins/alerting",
"xpack.alerting": "plugins/alerting",
"xpack.triggersActionsUI": "plugins/triggers_actions_ui",
"xpack.apm": ["legacy/plugins/apm", "plugins/apm"],
"xpack.beatsManagement": "legacy/plugins/beats_management",
Expand Down
41 changes: 1 addition & 40 deletions x-pack/legacy/plugins/alerting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { Legacy } from 'kibana';
import { Root } from 'joi';
import { init } from './server';
import mappings from './mappings.json';

export {
AlertingPlugin,
AlertsClient,
AlertType,
AlertExecutorOptions,
PluginSetupContract,
PluginStartContract,
} from './server';

export function alerting(kibana: any) {
return new kibana.Plugin({
id: 'alerting',
configPrefix: 'xpack.alerting',
require: ['kibana', 'elasticsearch', 'actions', 'task_manager', 'encryptedSavedObjects'],
isEnabled(config: Legacy.KibanaConfig) {
return (
config.get('xpack.alerting.enabled') === true &&
config.get('xpack.actions.enabled') === true &&
config.get('xpack.encryptedSavedObjects.enabled') === true &&
config.get('xpack.task_manager.enabled') === true
);
},
config(Joi: Root) {
return Joi.object()
.keys({
enabled: Joi.boolean().default(true),
})
.default();
},
init,
uiExports: {
mappings,
},
});
}
export * from './server';

This file was deleted.

This file was deleted.

34 changes: 28 additions & 6 deletions x-pack/legacy/plugins/alerting/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,32 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { AlertsClient as AlertsClientClass } from './alerts_client';
import { Legacy } from 'kibana';
import { Root } from 'joi';
import mappings from './mappings.json';

export type AlertsClient = PublicMethodsOf<AlertsClientClass>;

export { init } from './init';
export { AlertType, AlertingPlugin, AlertExecutorOptions } from './types';
export { PluginSetupContract, PluginStartContract } from './plugin';
export function alerting(kibana: any) {
return new kibana.Plugin({
id: 'alerting',
configPrefix: 'xpack.alerting',
require: ['kibana', 'elasticsearch', 'actions', 'task_manager', 'encryptedSavedObjects'],
isEnabled(config: Legacy.KibanaConfig) {
return (
config.get('xpack.alerting.enabled') === true &&
config.get('xpack.actions.enabled') === true &&
config.get('xpack.encryptedSavedObjects.enabled') === true &&
config.get('xpack.task_manager.enabled') === true
);
},
config(Joi: Root) {
return Joi.object()
.keys({
enabled: Joi.boolean().default(true),
})
.default();
},
uiExports: {
mappings,
},
});
}
28 changes: 0 additions & 28 deletions x-pack/legacy/plugins/alerting/server/init.ts

This file was deleted.

Loading

0 comments on commit a90ebe6

Please sign in to comment.