Skip to content

Commit

Permalink
Merge branch 'master' into disabling-ml-if-license-feature-is-disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Jul 28, 2020
2 parents b343af3 + abfda1f commit a51e2ef
Show file tree
Hide file tree
Showing 1,026 changed files with 18,128 additions and 12,924 deletions.
21 changes: 12 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -771,19 +771,22 @@ module.exports = {
},

/**
* APM overrides
* APM and Observability overrides
*/
{
files: ['x-pack/plugins/apm/**/*.js'],
files: [
'x-pack/plugins/apm/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/observability/**/*.{js,mjs,ts,tsx}',
],
rules: {
'no-unused-vars': ['error', { ignoreRestSiblings: true }],
'no-console': ['warn', { allow: ['error'] }],
},
},
{
plugins: ['react-hooks'],
files: ['x-pack/plugins/apm/**/*.{ts,tsx}'],
rules: {
'react/function-component-definition': [
'warn',
{
namedComponents: 'function-declaration',
unnamedComponents: 'arrow-function',
},
],
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': ['error', { additionalHooks: '^useFetcher$' }],
},
Expand Down
6 changes: 5 additions & 1 deletion docs/developer/advanced/running-elasticsearch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ This will run a snapshot of {es} that is usually built nightly. Read more about
----
yarn es snapshot
----
By default, two users are added to Elasticsearch:

- A superuser with username: `elastic` and password: `changeme`, which can be used to log into Kibana with.
- A user with username: `kibana_system` and password `changeme`. This account is used by the Kibana server to authenticate itself to Elasticsearch, and to perform certain actions on behalf of the end user. These credentials should be specified in your kibana.yml as described in <<using-kibana-with-security>>

See all available options, like how to specify a specific license, with the `--help` flag.

Expand Down Expand Up @@ -115,4 +119,4 @@ PUT _cluster/settings
}
----

Follow the cross-cluster search instructions for setting up index patterns to search across clusters (<<management-cross-cluster-search>>).
Follow the cross-cluster search instructions for setting up index patterns to search across clusters (<<management-cross-cluster-search>>).
4 changes: 2 additions & 2 deletions docs/developer/architecture/code-exploration.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,9 @@ WARNING: Missing README.
See Configuring security in Kibana.
- {kib-repo}blob/{branch}/x-pack/plugins/security_solution[securitySolution]
- {kib-repo}blob/{branch}/x-pack/plugins/security_solution/README.md[securitySolution]
WARNING: Missing README.
Welcome to the Kibana Security Solution plugin! This README will go over getting started with development and testing.
- {kib-repo}blob/{branch}/x-pack/plugins/snapshot_restore/README.md[snapshotRestore]
Expand Down
2 changes: 0 additions & 2 deletions docs/developer/contributing/development-tests.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ root)
|Functional
|`test/*integration/**/config.js` `test/*functional/**/config.js` `test/accessibility/config.js`
|`yarn test:ftr:server --config test/[directory]/config.js``yarn test:ftr:runner --config test/[directory]/config.js --grep=regexp`

|Karma |`src/**/public/__tests__/*.js` |`yarn test:karma:debug`
|===

For X-Pack tests located in `x-pack/` see
Expand Down
33 changes: 0 additions & 33 deletions docs/developer/contributing/development-unit-tests.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -95,38 +95,6 @@ to proceed in this mode.
node scripts/mocha --debug <file>
----

With `yarn test:karma`, you can run only the browser tests. Coverage
reports are available for browser tests by running
`yarn test:coverage`. You can find the results under the `coverage/`
directory that will be created upon completion.

[source,bash]
----
yarn test:karma
----

Using `yarn test:karma:debug` initializes an environment for debugging
the browser tests. Includes an dedicated instance of the {kib} server
for building the test bundle, and a karma server. When running this task
the build is optimized for the first time and then a karma-owned
instance of the browser is opened. Click the "`debug`" button to open a
new tab that executes the unit tests.

[source,bash]
----
yarn test:karma:debug
----

In the screenshot below, you’ll notice the URL is
`localhost:9876/debug.html`. You can append a `grep` query parameter
to this URL and set it to a string value which will be used to exclude
tests which don’t match. For example, if you changed the URL to
`localhost:9876/debug.html?query=my test` and then refreshed the
browser, you’d only see tests run which contain "`my test`" in the test
description.

image:http://i.imgur.com/DwHxgfq.png[Browser test debugging]

[discrete]
=== Unit Testing Plugins

Expand All @@ -141,5 +109,4 @@ command from your plugin:
[source,bash]
----
yarn test:mocha
yarn test:karma:debug # remove the debug flag to run them once and close
----
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ esFilters: {
convertRangeFilterToTimeRangeString: typeof convertRangeFilterToTimeRangeString;
mapAndFlattenFilters: (filters: import("../common").Filter[]) => import("../common").Filter[];
extractTimeFilter: typeof extractTimeFilter;
extractTimeRange: typeof extractTimeRange;
}
```
14 changes: 14 additions & 0 deletions docs/maps/trouble-shooting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ image::maps/images/inspector.png[]
[float]
=== Solutions to common problems

[float]
==== Index not listed when adding layer

* Verify your geospatial data is correctly mapped as {ref}/geo-point.html[geo_point] or {ref}/geo-shape.html[geo_shape].
** Run `GET myIndexPatternTitle/_field_caps?fields=myGeoFieldName` in <<console-kibana, Console>>, replacing `myIndexPatternTitle` and `myGeoFieldName` with your index pattern title and geospatial field name.
** Ensure response specifies `type` as `geo_point` or `geo_shape`.
* Verify your geospatial data is correctly mapped in your <<managing-fields, Kibana index pattern>>.
** Open your index pattern in <<management, Stack Management>>.
** Ensure your geospatial field type is `geo_point` or `geo_shape`.
** Ensure your geospatial field is searchable and aggregatable.
** If your geospatial field type does not match your Elasticsearch mapping, click the *Refresh* button to refresh the field list from Elasticsearch.
* Index patterns with thousands of fields can exceed the default maximum payload size.
Increase <<settings, `server.maxPayloadBytes`>> for large index patterns.

[float]
==== Features are not displayed

Expand Down
16 changes: 4 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
"kbn": "node scripts/kbn",
"es": "node scripts/es",
"test": "grunt test",
"test:karma": "grunt test:karma",
"test:karma:debug": "grunt test:karmaDebug",
"test:jest": "node scripts/jest",
"test:jest_integration": "node scripts/jest_integration",
"test:mocha": "node scripts/mocha",
Expand Down Expand Up @@ -317,6 +315,7 @@
"@types/accept": "3.1.1",
"@types/angular": "^1.6.56",
"@types/angular-mocks": "^1.7.0",
"@types/archiver": "^3.1.0",
"@types/babel__core": "^7.1.2",
"@types/bluebird": "^3.1.1",
"@types/boom": "^7.2.0",
Expand Down Expand Up @@ -398,6 +397,7 @@
"@types/testing-library__react-hooks": "^3.1.0",
"@types/type-detect": "^4.0.1",
"@types/uuid": "^3.4.4",
"@types/vinyl": "^2.0.4",
"@types/vinyl-fs": "^2.4.11",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "^2.34.0",
Expand Down Expand Up @@ -433,7 +433,7 @@
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.4",
"eslint-plugin-react-perf": "^3.2.3",
"exit-hook": "^2.2.0",
Expand All @@ -445,7 +445,6 @@
"grunt-available-tasks": "^0.6.3",
"grunt-cli": "^1.2.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-karma": "^3.0.2",
"grunt-peg": "^2.0.1",
"grunt-run": "0.8.1",
"gulp-babel": "^8.0.0",
Expand All @@ -463,17 +462,10 @@
"jest-raw-loader": "^1.0.1",
"jimp": "^0.9.6",
"json5": "^1.0.1",
"karma": "5.0.2",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "1.1.2",
"karma-firefox-launcher": "1.1.0",
"karma-ie-launcher": "1.0.0",
"karma-junit-reporter": "1.2.0",
"karma-mocha": "2.0.0",
"karma-safari-launcher": "1.0.0",
"license-checker": "^16.0.0",
"listr": "^0.14.1",
"load-grunt-config": "^3.0.1",
"load-json-file": "^6.2.0",
"mocha": "^7.1.1",
"mock-fs": "^4.12.0",
"mock-http-server": "1.3.0",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"normalize-path": "^3.0.0",
"moment": "^2.24.0",
"rxjs": "^6.5.5",
"strip-ansi": "^6.0.0",
"tree-kill": "^1.2.2",
"tslib": "^2.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

export { withProcRunner, ProcRunner } from './proc_runner';
export * from './tooling_log';
export { createAbsolutePathSerializer } from './serializers';
export * from './serializers';
export {
CA_CERT_PATH,
ES_KEY_PATH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { REPO_ROOT } from '../repo_root';

export function createAbsolutePathSerializer(rootPath: string = REPO_ROOT) {
return {
serialize: (value: string) => value.replace(rootPath, '<absolute path>').replace(/\\/g, '/'),
test: (value: any) => typeof value === 'string' && value.startsWith(rootPath),
serialize: (value: string) => value.replace(rootPath, '<absolute path>').replace(/\\/g, '/'),
};
}
25 changes: 25 additions & 0 deletions packages/kbn-dev-utils/src/serializers/any_instance_serizlizer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export function createAnyInstanceSerializer(Class: Function, name?: string) {
return {
test: (v: any) => v instanceof Class,
serialize: () => `<${name ?? Class.name}>`,
};
}
5 changes: 4 additions & 1 deletion packages/kbn-dev-utils/src/serializers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
* under the License.
*/

export { createAbsolutePathSerializer } from './absolute_path_serializer';
export * from './absolute_path_serializer';
export * from './strip_ansi_serializer';
export * from './recursive_serializer';
export * from './any_instance_serizlizer';
29 changes: 29 additions & 0 deletions packages/kbn-dev-utils/src/serializers/recursive_serializer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export function createRecursiveSerializer(test: (v: any) => boolean, print: (v: any) => string) {
return {
test: (v: any) => test(v),
serialize: (v: any, ...rest: any[]) => {
const replacement = print(v);
const printer = rest.pop()!;
return printer(replacement, ...rest);
},
};
}
29 changes: 29 additions & 0 deletions packages/kbn-dev-utils/src/serializers/strip_ansi_serializer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import stripAnsi from 'strip-ansi';

import { createRecursiveSerializer } from './recursive_serializer';

export function createStripAnsiSerializer() {
return createRecursiveSerializer(
(v) => typeof v === 'string' && stripAnsi(v) !== v,
(v) => stripAnsi(v)
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ exports.getWebpackConfig = function (kibanaPath, projectRoot, config) {
const alias = {
// Kibana defaults https://github.com/elastic/kibana/blob/6998f074542e8c7b32955db159d15661aca253d7/src/legacy/ui/ui_bundler_env.js#L30-L36
ui: fromKibana('src/legacy/ui/public'),
test_harness: fromKibana('src/test_harness/public'),

// Dev defaults for test bundle https://github.com/elastic/kibana/blob/6998f074542e8c7b32955db159d15661aca253d7/src/core_plugins/tests_bundle/index.js#L73-L78
ng_mock$: fromKibana('src/test_utils/public/ng_mock'),
'angular-mocks$': fromKibana(
'src/legacy/core_plugins/tests_bundle/webpackShims/angular-mocks.js'
),
fixtures: fromKibana('src/fixtures'),
test_utils: fromKibana('src/test_utils/public'),
};
Expand Down
4 changes: 0 additions & 4 deletions packages/kbn-plugin-generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ Generated plugins receive a handful of scripts that can be used during developme
Build a distributable archive of your plugin.
- `yarn test:karma`
Run the browser tests in a real web browser.
- `yarn test:mocha`
Run the server tests using mocha.
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-plugin-helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ $ plugin-helpers help
start Start kibana and have it include this plugin
build [options] [files...] Build a distributable archive
test Run the server and browser tests
test:karma [options] Run the browser tests in a real web browser
test:mocha [files...] Run the server tests using mocha

Options:
Expand Down
19 changes: 0 additions & 19 deletions packages/kbn-plugin-helpers/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,6 @@ program
}))
);

program
.command('test')
.description('Run the server and browser tests')
.on('--help', docs('test/all'))
.action(createCommanderAction('testAll'));

program
.command('test:karma')
.description('Run the browser tests in a real web browser')
.option('--dev', 'Enable dev mode, keeps the test server running')
.option('-p, --plugins <plugin-ids>', "Manually specify which plugins' test bundles to run")
.on('--help', docs('test/karma'))
.action(
createCommanderAction('testKarma', (command) => ({
dev: Boolean(command.dev),
plugins: command.plugins,
}))
);

program
.command('test:mocha [files...]')
.description('Run the server tests using mocha')
Expand Down
Loading

0 comments on commit a51e2ef

Please sign in to comment.