Skip to content

Commit

Permalink
Merge branch 'master' into usage_collection/better_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jan 18, 2021
2 parents 39f8fc1 + f7fdda5 commit d92a710
Show file tree
Hide file tree
Showing 138 changed files with 2,265 additions and 2,723 deletions.
29 changes: 8 additions & 21 deletions .ci/Jenkinsfile_flaky
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ kibanaLibrary.load()

def CI_GROUP_PARAM = params.CI_GROUP

// Looks like 'oss:ciGroup:1', 'oss:firefoxSmoke', or 'all:serverMocha'
// Looks like 'oss:ciGroup:1', 'oss:firefoxSmoke'
def JOB_PARTS = CI_GROUP_PARAM.split(':')
def IS_XPACK = JOB_PARTS[0] == 'xpack'
def JOB = JOB_PARTS[1]
def NEED_BUILD = JOB != 'serverMocha'
def CI_GROUP = JOB_PARTS.size() > 2 ? JOB_PARTS[2] : ''
def EXECUTIONS = params.NUMBER_EXECUTIONS.toInteger()
def AGENT_COUNT = getAgentCount(EXECUTIONS)
Expand All @@ -31,15 +30,13 @@ kibanaPipeline(timeoutMinutes: 180) {
print "Agent ${agentNumberInside} - ${agentExecutions} executions"

workers.functional('flaky-test-runner', {
if (NEED_BUILD) {
if (!IS_XPACK) {
kibanaPipeline.buildOss()
if (CI_GROUP == '1') {
runbld("./test/scripts/jenkins_build_kbn_sample_panel_action.sh", "Build kbn tp sample panel action for ciGroup1")
}
} else {
kibanaPipeline.buildXpack()
if (!IS_XPACK) {
kibanaPipeline.buildOss()
if (CI_GROUP == '1') {
runbld("./test/scripts/jenkins_build_kbn_sample_panel_action.sh", "Build kbn tp sample panel action for ciGroup1")
}
} else {
kibanaPipeline.buildXpack()
}
}, getWorkerMap(agentNumberInside, agentExecutions, worker, workerFailures))()
}
Expand All @@ -60,17 +57,7 @@ kibanaPipeline(timeoutMinutes: 180) {

def getWorkerFromParams(isXpack, job, ciGroup) {
if (!isXpack) {
if (job == 'serverMocha') {
return kibanaPipeline.functionalTestProcess('serverMocha', {
kibanaPipeline.bash(
"""
source src/dev/ci_setup/setup_env.sh
node scripts/mocha
""",
"run `node scripts/mocha`"
)
})
} else if (job == 'accessibility') {
if (job == 'accessibility') {
return kibanaPipeline.functionalTestProcess('kibana-accessibility', './test/scripts/jenkins_accessibility.sh')
} else if (job == 'firefoxSmoke') {
return kibanaPipeline.functionalTestProcess('firefoxSmoke', './test/scripts/jenkins_firefox_smoke.sh')
Expand Down
8 changes: 0 additions & 8 deletions .ci/teamcity/tests/mocha.sh

This file was deleted.

12 changes: 3 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ const SAFER_LODASH_SET_DEFINITELYTYPED_HEADER = `
*/
`;

const allMochaRulesOff = {};
Object.keys(require('eslint-plugin-mocha').rules).forEach((k) => {
allMochaRulesOff['mocha/' + k] = 'off';
});

module.exports = {
root: true,

Expand Down Expand Up @@ -542,7 +537,6 @@ module.exports = {
'packages/kbn-eslint-import-resolver-kibana/**/*.js',
'packages/kbn-eslint-plugin-eslint/**/*',
'x-pack/gulpfile.js',
'x-pack/dev-tools/mocha/setup_mocha.js',
'x-pack/scripts/*.js',
],
excludedFiles: ['**/integration_tests/**/*'],
Expand Down Expand Up @@ -574,7 +568,9 @@ module.exports = {
*/
{
files: ['test/harden/*.js', 'packages/elastic-safer-lodash-set/test/*.js'],
rules: allMochaRulesOff,
rules: {
'mocha/handle-done-callback': 'off',
},
},
{
files: ['**/*.{js,mjs,ts,tsx}'],
Expand Down Expand Up @@ -794,7 +790,6 @@ module.exports = {
files: ['x-pack/plugins/security_solution/**/*.{js,mjs,ts,tsx}'],
plugins: ['eslint-plugin-node', 'react'],
env: {
mocha: true,
jest: true,
},
rules: {
Expand Down Expand Up @@ -930,7 +925,6 @@ module.exports = {
files: ['x-pack/plugins/lists/**/*.{js,mjs,ts,tsx}'],
plugins: ['eslint-plugin-node'],
env: {
mocha: true,
jest: true,
},
rules: {
Expand Down
29 changes: 11 additions & 18 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,6 @@
#CC# /x-pack/legacy/plugins/canvas/ @elastic/kibana-presentation
#CC# /x-pack/plugins/dashboard_mode @elastic/kibana-presentation

# Core UI
# Exclude tutorials folder for now because they are not owned by Kibana app and most will move out soon
/src/plugins/home/public @elastic/kibana-core-ui
/src/plugins/home/server/*.ts @elastic/kibana-core-ui
/src/plugins/home/server/services/ @elastic/kibana-core-ui
/src/plugins/kibana_overview/ @elastic/kibana-core-ui
/x-pack/plugins/global_search_bar/ @elastic/kibana-core-ui
#CC# /src/plugins/newsfeed @elastic/kibana-core-ui
#CC# /src/plugins/home/public @elastic/kibana-core-ui
#CC# /src/plugins/home/server/services/ @elastic/kibana-core-ui
#CC# /src/plugins/home/ @elastic/kibana-core-ui
#CC# /x-pack/plugins/global_search_providers/ @elastic/kibana-core-ui

# Observability UIs
/x-pack/plugins/infra/ @elastic/logs-metrics-ui
Expand Down Expand Up @@ -138,10 +126,6 @@
/x-pack/test/functional/apps/maps/ @elastic/kibana-gis
/x-pack/test/functional/es_archives/maps/ @elastic/kibana-gis
/x-pack/test/visual_regression/tests/maps/index.js @elastic/kibana-gis
/x-pack/plugins/stack_alerts/server/alert_types/geo_containment @elastic/kibana-gis
/x-pack/plugins/stack_alerts/public/alert_types/geo_containment @elastic/kibana-gis
/x-pack/plugins/stack_alerts/server/alert_types/geo_threshold @elastic/kibana-gis
/x-pack/plugins/stack_alerts/public/alert_types/geo_threshold @elastic/kibana-gis
#CC# /src/plugins/maps_legacy/ @elastic/kibana-gis
#CC# /src/plugins/maps_oss/ @elastic/kibana-gis
#CC# /x-pack/plugins/file_upload @elastic/kibana-gis
Expand Down Expand Up @@ -200,6 +184,11 @@
/src/plugins/status_page/ @elastic/kibana-core
/src/plugins/saved_objects_management/ @elastic/kibana-core
/src/dev/run_check_published_api_changes.ts @elastic/kibana-core
/src/plugins/home/public @elastic/kibana-core
/src/plugins/home/server/*.ts @elastic/kibana-core
/src/plugins/home/server/services/ @elastic/kibana-core
/src/plugins/kibana_overview/ @elastic/kibana-core
/x-pack/plugins/global_search_bar/ @elastic/kibana-core
#CC# /src/core/server/csp/ @elastic/kibana-core
#CC# /src/legacy/server/config/ @elastic/kibana-core
#CC# /src/legacy/server/http/ @elastic/kibana-core
Expand All @@ -210,6 +199,11 @@
#CC# /x-pack/plugins/cloud/ @elastic/kibana-core
#CC# /x-pack/plugins/features/ @elastic/kibana-core
#CC# /x-pack/plugins/global_search/ @elastic/kibana-core
#CC# /src/plugins/newsfeed @elastic/kibana-core
#CC# /src/plugins/home/public @elastic/kibana-core
#CC# /src/plugins/home/server/services/ @elastic/kibana-core
#CC# /src/plugins/home/ @elastic/kibana-core
#CC# /x-pack/plugins/global_search_providers/ @elastic/kibana-core

# Kibana Telemetry
/packages/kbn-analytics/ @elastic/kibana-core
Expand All @@ -236,7 +230,6 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
# Security
/src/core/server/csp/ @elastic/kibana-security @elastic/kibana-core
/src/plugins/security_oss/ @elastic/kibana-security
/src/plugins/spaces_oss/ @elastic/kibana-security
/test/security_functional/ @elastic/kibana-security
/x-pack/plugins/spaces/ @elastic/kibana-security
/x-pack/plugins/encrypted_saved_objects/ @elastic/kibana-security
Expand All @@ -263,7 +256,7 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/ @elastic/kibana-alerting-services
/docs/user/alerting/ @elastic/kibana-alerting-services
/docs/management/alerting/ @elastic/kibana-alerting-services
#CC# /x-pack/plugins/stack_alerts/ @elastic/kibana-alerting-services
#CC# /x-pack/plugins/stack_alerts @elastic/kibana-alerting-services

# Enterprise Search
# Shared
Expand Down
1 change: 0 additions & 1 deletion .teamcity/src/builds/test/QuickTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ object QuickTests : BuildType({
val testScripts = mapOf(
"Test Hardening" to ".ci/teamcity/checks/test_hardening.sh",
"Test Projects" to ".ci/teamcity/tests/test_projects.sh",
"Mocha Tests" to ".ci/teamcity/tests/mocha.sh"
)

steps {
Expand Down
6 changes: 0 additions & 6 deletions docs/developer/contributing/development-tests.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ root)
|Jest (integration) |`**/integration_tests/**/*.test.{js,mjs,ts,tsx}`
|`yarn test:jest_integration [test path]`

|Mocha
|`**/__tests__/**/*.js`
|`node scripts/mocha --grep=regexp [test path]`

|Functional
|`test/**/config.js` `x-pack/test/**/config.js`
|`node scripts/functional_tests_server --config [directory]/config.js``node scripts/functional_test_runner_ --config [directory]/config.js --grep=regexp`
Expand Down Expand Up @@ -60,8 +56,6 @@ kibana/src/plugins/dashboard/server$ yarn test:jest --coverage
yarn jest --coverage --verbose --config /home/tyler/elastic/kibana/src/plugins/dashboard/jest.config.js server
----

NOTE: There are still a handful of legacy tests that use the Mocha test runner. For those tests, use `node scripts/mocha --grep=regexp [test path]`. Tests using Mocha are located within `__tests__` directories.


[discrete]
=== Running browser automation tests
Expand Down
34 changes: 4 additions & 30 deletions docs/developer/contributing/development-unit-tests.asciidoc
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
[[development-unit-tests]]
== Unit testing frameworks

{kib} is migrating unit testing from `Mocha` to `Jest`. Legacy unit tests
still exist in Mocha but all new unit tests should be written in Jest.

[discrete]
=== Mocha (legacy)

Mocha tests are contained in `__tests__` directories.

*Running Mocha Unit Tests*

["source","shell"]
-----------
yarn test:mocha
-----------
{kib} is doing unit testing doing `Jest`.

[discrete]
== Jest
Expand Down Expand Up @@ -92,23 +79,10 @@ the `--debug-brk` flag. You’ll need to connect a remote debugger such
as https://github.com/node-inspector/node-inspector[`node-inspector`]
to proceed in this mode.

[source,bash]
----
node scripts/mocha --debug <file>
----

[discrete]
=== Unit Testing Plugins

This should work super if you’re using the
Even when using
https://github.com/elastic/kibana/tree/master/packages/kbn-plugin-generator[Kibana
plugin generator]. If you’re not using the generator, well, you’re on
your own. We suggest you look at how the generator works.

To run the tests for just your particular plugin run the following
command from your plugin:

[source,bash]
----
yarn test:mocha
----
plugin generator] we do not enforce a way for unit testing your plugin. Please setup and you use
the tools of your choice. If the plugin will live inside the Kibana repo `Jest` must be used.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ image::images/job_view.png[]
[discrete]
=== Viewing ciGroup/test Logs

To view the logs for a failed specific ciGroup, jest, mocha, type checkers, linters, etc., click on the *Pipeline Steps* link in from the Job page.
To view the logs for a failed specific ciGroup, jest, type checkers, linters, etc., click on the *Pipeline Steps* link in from the Job page.

image::images/pipeline_steps_view.png[]

Expand Down
58 changes: 29 additions & 29 deletions docs/user/dashboard/vega-reference.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -216,24 +216,8 @@ on the currently picked range: `"interval": {"%autointerval%": 10}` will
try to get about 10-15 data points (buckets).

[float]
[[vega-esmfiles]]
=== Access Elastic Map Service files

experimental[] Access the Elastic Map Service files via the same mechanism:

[source,yaml]
----
url: {
// "type" defaults to "elasticsearch" otherwise
type: emsfile
// Name of the file, exactly as in the Region map visualization
name: World Countries
}
// The result is a geojson file, get its features to use
// this data source with the "shape" marks
// https://vega.github.io/vega/docs/marks/shape/
format: {property: "features"}
----
[[vega-with-a-map]]
=== Vega with a Map

To enable Maps, the graph must specify `type=map` in the host
configuration:
Expand Down Expand Up @@ -282,6 +266,22 @@ Additionally, you can use `latitude`, `longitude`, and `zoom` signals.
These signals can be used in the graph, or can be updated to modify the
position of the map.

experimental[] You can use Vega's https://vega.github.io/vega/docs/data/[data] element to access https://www.elastic.co/elastic-maps-service[Elastic Maps Service (EMS)] vector shapes of administrative boundaries in your Vega map by setting `url.data` to `emsFile`:

[source,yaml]
----
url: {
// "type" defaults to "elasticsearch" otherwise
type: emsfile
// Name of the file, exactly as in the Region map visualization
name: World Countries
}
// The result is a geojson file, get its features to use
// this data source with the "shape" marks
// https://vega.github.io/vega/docs/marks/shape/
format: {property: "features"}
----

[float]
[[vega-tooltip]]
==== Additional tooltip styling
Expand All @@ -308,22 +308,22 @@ a configuration option for changing the tooltip position and padding:
[[vega-url-loading]]
==== Advanced setting to enable URL loading from any domain

Vega can load data from any URL, but this is disabled by default in {kib}.
Vega can load data from any URL, but this is disabled by default in {kib}.
To change this, set `vis_type_vega.enableExternalUrls: true` in `kibana.yml`,
then restart {kib}.

[float]
[[vega-inspector]]
==== Vega Inspector
Use the contextual *Inspect* tool to gain insights into different elements.
Use the contextual *Inspect* tool to gain insights into different elements.
For Vega visualizations, there are two different views: *Request* and *Vega debug*.

[float]
[[inspect-elasticsearch-requests]]
===== Inspect {es} requests

Vega uses the {ref}/search-search.html[{es} search API] to get documents and aggregation
results from {es}. To troubleshoot these requests, click *Inspect*, which shows the most recent requests.
Vega uses the {ref}/search-search.html[{es} search API] to get documents and aggregation
results from {es}. To troubleshoot these requests, click *Inspect*, which shows the most recent requests.
In case your specification has more than one request, you can switch between the views using the *View* dropdown.

[role="screenshot"]
Expand All @@ -333,10 +333,10 @@ image::visualize/images/vega_tutorial_inspect_requests.png[]
[[vega-debugging]]
===== Vega debugging

With the *Vega debug* view, you can inspect the *Data sets* and *Signal Values* runtime data.
The runtime data is read from the
https://vega.github.io/vega/docs/api/debugging/#scope[runtime scope].
With the *Vega debug* view, you can inspect the *Data sets* and *Signal Values* runtime data.

The runtime data is read from the
https://vega.github.io/vega/docs/api/debugging/#scope[runtime scope].

[role="screenshot"]
image::visualize/images/vega_tutorial_inspect_data_sets.png[]
Expand All @@ -348,15 +348,15 @@ the <<vega-browser-debugging-console, Vega browser debugging process>>.
[[asking-for-help-with-a-vega-spec]]
===== Asking for help with a Vega spec

Because of the dynamic nature of the data in {es}, it is hard to help you with
Because of the dynamic nature of the data in {es}, it is hard to help you with
Vega specs unless you can share a dataset. To do this, click *Inspect*, select the *Vega debug* view,
then select the *Spec* tab:

[role="screenshot"]
image::visualize/images/vega_tutorial_getting_help.png[]

To copy the response, click *Copy to clipboard*. Paste the copied data to
https://gist.github.com/[gist.github.com], possibly with a .json extension. Use the [raw] button,
To copy the response, click *Copy to clipboard*. Paste the copied data to
https://gist.github.com/[gist.github.com], possibly with a .json extension. Use the [raw] button,
and share that when asking for help.

[float]
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"es": "node scripts/es",
"test:jest": "node scripts/jest",
"test:jest_integration": "node scripts/jest_integration",
"test:mocha": "node scripts/mocha",
"test:ftr": "node scripts/functional_tests",
"test:ftr:server": "node scripts/functional_tests_server",
"test:ftr:runner": "node scripts/functional_test_runner",
Expand Down
Loading

0 comments on commit d92a710

Please sign in to comment.