Commit graph

140 commits

Author SHA1 Message Date
Tiago Costa 1155b81b4f
Remove husky (#24887)
* feat(NA): remove husky dependency and implement a git hooks registering mechanism.

* fix(NA): apply executable chmod to the created kbn git hook script.

* fix(NA): run npm script on the git pre commit hook silently.

* refact(NA): apply changes according the PR review.

* refact(NA): apply changes according PR review.
2018-11-15 01:34:45 +00:00
Leanid Shutau 1e5d82c2ab
Integrate main i18n tool into build pipeline (#22254)
* Integrate main i18n tool to build process

* Resolve comments

* Remove old task

* Replace default Error with FailError
2018-08-29 11:55:34 +03:00
Tim Roes 743edc6c0e
Make panel action tests more generic (#22174)
* Make panel action tests more generic

* Remove test file

* Add simple app tests

* Shorten/fix import

* Remove unneeded task

* Add debug output

* Allow duplicate --plugin-path params

* Remove debugging options

* Add README
2018-08-20 21:48:38 +02:00
Spencer b4e1193015
Revert "Run some functional tests against kibana in production mode (#21899)" (#22111)
This reverts commit 63df7cb2e4.

It seems this caused unintended failures on master, will resubmit after CI is green
2018-08-16 23:28:37 -07:00
Spencer 63df7cb2e4
Run some functional tests against kibana in production mode (#21899)
Right now the functional tests are run against a distributable of Kibana in CI, but that distributable is running with `--env.name=development`. That causes the optimizer to run again before the tests can start and prevents the functional tests from running against the actual version of the application users will end up getting. This seems necessary for some tests, but not all of them, but I would like to get all of the tests running against the production version of Kibana soon.

This PR implements a second ftr config, `test/functional_production` that uses basically a copy of the `test/functional` config but with a few minor adjustments, removing the `--env.name=development` kbnServerArg and using a unique junit report name. To accomplish this I needed to modify the `@kbn/test` module to only pass the `--dev` flag to the Kibana server if it is being run in development mode, which it currently does by testing the args for `--env.name=development` or two args next to each other: `'--env.name'` and `'development'`. It does this by converting the `extraKbnOpts` option into an `addExtraKbnArgs` function, which is called with the final args just before passing them to the proc runner and given a chance to modify then after all other args are resolved (pulling from different places in config based on the build type, etc.)

Over the next couple weeks I'll push up PRs for individual test suites, migrating them over to the new production config, hopefully in a short period of time we will have all the function test suites back under that `test/function` config and can run them all against the Kibana server in production mode.
2018-08-16 12:15:58 -07:00
Spencer 141a97d93c
[TypeScript] add type-check script (#19325)
* [TypeScript] add type-check script

* [ci] run scripts/type_check after linting

* [ts] improve filterProjectsByFlag readability

* fix typo

* simplify type signature
2018-08-09 17:19:24 -07:00
Spencer 4f0d2ade1e
[kbn-test] convert kibana-install-dir flag to installDir option (#21317)
* [kbn-test] convert kibana-install-dir flag to installDir option

* [kbn-test] replicate kibana-install-dir handling to startServers

* [ftr] try running functional tests in production in CI

* Revert "[ftr] try running functional tests in production in CI"

This reverts commit e5b94aa024.

* [core/public/legacyPlatform] exclude ui/test_harness from the distributable

* [optimizer] fix `process.env.IS_KIBANA_DISTRIBUTABLE` definition

* [optimizer] only define `process.env.IS_KIBANA_DISTRIBUTABLE` when needed

Adding a `webpack.DefinePlugin` slows down the optimizer a small amount,
so only apply it when it is necessary, and skip it if it is going to
be defined as "false".

* [kbn-test/startServer] don't run in --dev mode if running from dist

* [ftr/kibanaServer/version] attach `-SNAPSHOT` suffix to version if running build_snapshot
2018-08-02 17:23:34 -07:00
Stacey Gammon bed72f224d
Add pluggable panel action tests (#20163)
* Add pluggable panel action tests

* address code review comments

* update inspector snapshot

* remove temp declared ts module now that eui has EuiFlyout typings

* address code comments
2018-07-28 10:41:57 -04:00
Leanid Shutau 9c9159ce0c
Implement a build tool for default messages extraction (#19620)
* Implement a build tool for default messages extraction

* Refactor extraction tool, resolve review comments, fix bugs

* Resolve comments, refactor extraction tool, fix bugs

* Add context to messages extraction tool

* Resolve comments

* Fix bugs

* Add messages extraction from .jade files, refactor code

* Add template literals parsing

* Return defaultMessages.json to plain structure

* Refactor utils

* Fix bugs

* Refactor code, resolve review comments, fix bugs

* Fix minor bug

* Get rid of '@babel/traverse' and add its native implementation

* Add handlebars messages extraction

* Fix mkdir on macOS

* Fix bugs, inject default formats, finalize the tool

* Fix filsystem permissions

* Refactor nodes traversal

* Update code style

* Downgrade @babel/types to fix build issues

* Resolve comments

* Fix minor bugs
2018-07-17 15:56:55 +03:00
Tiago Costa dc907ace5b
chore(NA): remove node version validator from git pre-commit hook script. (#19950) 2018-06-15 16:14:48 +01:00
Chris Davies 7ecd638d75
Change check_file_casing to require setup_node_env (#19499) 2018-05-29 11:48:43 -04:00
Spencer f0cc432faf
Apache 2.0 license headers (#19383)
In order to make the license that applies to each file as clear as possible, and to be consistent with elasticsearch, we are adding Apache 2.0 license headers to the top of each file.

Existence of this header is enforced by eslint and tslint and missing headers were automatically added in the last commit by running:

```
node scripts/eslint --fix && node scripts/tslint --fix
```
2018-05-28 20:06:30 -07:00
Chris Davies b98eefd9f3
Fix check_file_casing babel_register reference (#19457) 2018-05-25 17:18:15 -04:00
Tiago Costa 194aba149f
Validate current node version (#19154)
* feat(12976): node version validation at runtime.

* refact(12976): move the code into a static utilities class.

* test(12976): added first test case using jest.

* test(12976): added test cases for node_version.

* feat(12976): create setup env node to bootstrap babel, ts-node and node version validator.

* refact(12976): migrated node version code from es6 to es5.

* feat(12976): node version validation at runtime.

* refact(12976): move the code into a static utilities class.

* test(12976): added first test case using jest.

* test(12976): added test cases for node_version.

* feat(12976): create setup env node to bootstrap babel, ts-node and node version validator.

* refact(12976): migrated node version code from es6 to es5.

* fix(12976): remove one level from ts node register cache directory link.

* chore(12976): added caret to semver dependecy in order to support minor versions.

* refact(12976): small change from named import to default import on node version validator.

* refact(12976): removed ts_node_register and add the code to babel_register.

* feat(12976): split eslint config in order to properly support files built to run before and after node version validator. refact(12976): convert script files to es5 code. refact(12976): delete inline eslint configs from node version check related files.

* refact(12976): remove ts node register file.

* refact(12976): completely port setup_node_env to es5.

* refact(12976): remove babel_register invokation from external dependencies in scripts.

* refact(12976): move node_version code directly into node_version_validator inside setup_node_env folder.

* refact(12976): only node version validator for kbn script.
2018-05-25 18:43:01 +01:00
Spencer e50fd2403b
Check filename casing in CI (#19282)
* [dev/checkCasing] add script to find casing violations

* [dev/casingCheck] fix es-ES.json violation
2018-05-24 11:38:42 -07:00
Spencer 4c2a90dbdd
[tslint] lint typescript code (#19105)
* [tslint] lint typescript code

* [tslint] filter projects when running specific project

* [dev/ts] use more explicit types

* [dev/ts] add note about why using glob

* [dev/ts] rely on ts, use fewer getters
2018-05-22 14:00:02 -07:00
Spencer f24a725144
[mocha] remove grunt-simple-mocha (#19079)
* [mocha] run tests with mocha script, remove grunt-simple-mocha

* [ci] force colored output

* [ci] disable color when reading the yarn bin

* [dev/build/exec] support tooling log having its own chalk

* [dev/mocha] avoid changing the cwd of the process

* [dev/mocha] only match files, speed up negative matches

* [cli/serve/test] strip ansi control characters from logs

* [ci] disable color in all `yarn bin` invocations

* [dev/mocha] cleanup old runInBand check

* [dev/mocha] enable gloabl leak checks
2018-05-16 10:43:55 -07:00
archana b58e757794
Functional test setup with kbn-test package (#18568)
Restructure testing with kbn-test package

 - Run with multiple configs, move cli options to config
 - Package-ify kbn-test
 - Eventually we'll have functional_test_runner live in a package
of its own, and then this kbn-test will use that as a dependency,
probably still as a devDependency.
 - Implement functional_tests_server
 - Collapse single and multiple config apis into one command

Use kbn-es

Replace es_test_cluster + es_test_config with kbn/test utils

Implement new createEsTestCluster

Improve scripts, jsdocs, cli top-level tools

Lift error handling to the top level
2018-05-09 18:23:49 -05:00
Tyler Smalley 5d8cf56532
[kbn-es] Use basic license as default (#18577)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2018-04-25 14:00:24 -07:00
Jenkins CI fe4609647d Migrate x-pack-kibana source to kibana 2018-04-24 13:48:10 -07:00
Spencer 608a1e3553
Add/generate/verify NOTICE.txt file (#17504)
* [dev/notice] add scripts for generating NOTICE.txt file

* [notice] react-resize-detector@0.6.0 was removed in b445389b79

* [notice] move notice text into relevant source

* [dev/notice] Generate NOTICE.txt file

* [jenkins] verify that notice.txt is up to date in CI

* [tasks/notice] update test to use new NOTICE.txt file

* [dev/notice] update company name in NOTICE.txt

* [notice/cli] exit with 0 when --help requested

* [notice/cli] add helpful logging

* [notice/cli] use --validate flag name instead

* [notice/cli] simplify NEWLINE_RE, ignore obscure line endings

* [utils/decode_geo_hash] fixup comment

* [utils/decode_geo_hash] remove useless comment
2018-04-04 09:12:44 -07:00
Tyler Smalley 82e17f435f
[kbn-es] Package for managing Elasticsearch during dev and testing (#17168)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2018-03-20 08:30:15 -07:00
Aleh Zasypkin f2fda4aca3
Introduce Jest integration tests. (#16735) 2018-02-19 17:02:01 +01:00
Spencer 4d246a10a8
[kbn-pm] rename from kbn-build (#16739) 2018-02-14 10:57:13 -07:00
Spencer 2c7a1f34cb
[kbn-plugin-generator] add plugin generator to the repo (#16655)
* [kbn-plugin-generator] add plugin generator to the repo

* [plugin-generator] use snake_case plugin name for directory name

* [plugin-generator] fix typo

* [plugin-generator] remove translation support until we resume i18n efforts

* [yarn] update lockfile

* [mocha] remove plugin-generator selector from mocha tests

* [plugin-generator] update generated readme to recommend yarn

* [plugin-generator] add readme to generator pacakge

* [plugin-generator] link from plugin-resource docs

* [plugin-generator] mention very important `kbn bootstrap` script

* [plugin-generator] rework some parts of the README

* [plugin-generator] log actual directory name with system separators

* [plugin-generator] include bootstrap/yarn preinstall check script
2018-02-12 12:23:23 -07:00
Jonathan Budzenski 37e42432c6
Snake case scripts/kibana-keystore.js and scripts/kibana-plugin.js (#15331) 2018-02-02 09:54:02 -06:00
Kim Joar Bekkelund 08e48aa847
Kibana build tool (#15055)
* Introduce `kbn`, the Kibana build tool

* yarn kbn

* Make all deps devDeps

* Exclude __fixtures__ folder from Jest to avoid warnings

* Review fixes

* Update readme

* Use 'yarn kbn'

* Consistent rootPath

* Link to kbn tool

* Unsupported URL 'debug help' in contributing guide
2018-01-24 10:34:52 +01:00
Spencer f71ec29bd6
[CI] Produce junit test reports (#15281)
* [mocha] use custom reporter for legible results in jenkins

* [jest] use custom result processor for legible results in jenkins

* [karma] enable junit output on CI

* [mocha/junitReporter] accept rootDirectory as configuration

* [jest/reporter] use reporters option added in jest 20

* [toolingLog] remove black/white specific colors

* [dev/mocha/junit] no reason for junit to be a "reporter"

* typos

* [dev/mocha/junit] use else if

* [karma/junit] use string#replace for explicitness

* [junit] use test file path as "classname"

* [ftr/mocha] no longer a "console" specific reporter
2017-12-05 17:29:48 -07:00
Jonathan Budzenski ee4828b726
Remove node fallback from kibana-keystore (#15066) 2017-11-27 10:11:38 -06:00
Jonathan Budzenski 218986c07e
Create separate startup scripts for development and production (#13806)
* Use separate startup scripts for development and production

* build kibana directly

* [build] Use downloaded node when pre-optimizing

* clearer variable name

* Add breaking changes docs
2017-11-22 12:49:37 -06:00
Spencer 95329c581f
[precommit hook] add dev script (#14890)
* [precommitHook] move to dev script

* [eslint] fix lint error

* [dev/eslint] do simply boolean checks first

* [dev] use shared REPO_ROOT constant

* [dev/File] precompute relative/ext of path

* [dev/eslint] fix relative import

* [dev/eslint] fix typos

* [grunt] remove unused run:eslintStaged config

* [dev/run] only create log if we are going to use it

* [dev/run/isFailError] ensure return value is Boolean

* [dev/precommitHook] use less intermediate vars
2017-11-20 14:22:24 -07:00
Spencer a3014d7a63
[eslint] add eslint dev script (#14889) 2017-11-14 10:11:59 -07:00
Søren Louv-Jansen 7dbb01552e Add Backport to toolchain (#14525) 2017-10-24 16:38:18 -04:00
Spencer 48d35f81fd create babel-preset and babel-register modules (#13973)
* [babel] create babel-preset and babel-register modules

* [babel-preset] add comments to babel-preset-env.target choices

* [babel-preset] use more normal BUILT_WITH_BABEL signal

* [babel-register] extended comment about filtering ./src in dist

* [babel-preset] stage of class properties has changed, sorta
2017-09-19 17:44:47 -07:00
Court Ewing 7b836f91b2 Shortcut to build asciidocs (#13164)
* Shortcut to build asciidocs

The command to build the Kibana docs using the elastic/docs repo can be
easy to forget, so this script is an easy to way to do it right every
time.

* Configurable docs repo location

For folks that clone the elastic docs repo to a different location than
as a sibling of kibana.
2017-08-23 10:27:34 -04:00
Spencer d3ba428796 [ftr] make room for more projects (#11848)
Squashed commit of the following:

commit 659ea986fdeb9a5ff2ca1fa5360cccb01c671ede
Author: spalger <spalger@users.noreply.github.com>
Date:   Wed May 17 09:19:22 2017 -0700

    [test/*/fixtures] rename es_archives to es_archiver

commit d3667457c78e88e2d6974f3c38dd0fe61b846b91
Author: spalger <spalger@users.noreply.github.com>
Date:   Wed May 17 08:22:03 2017 -0700

    [ftr/config] fix default directory value functions

commit 9a6a2cc0b295e2281e83da04fcea40e9d6f00781
Author: spalger <spalger@users.noreply.github.com>
Date:   Wed May 17 07:30:52 2017 -0700

    fix import paths

commit fcb65a877d54b5b1d36b8c81f1264b36845e826e
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 21:39:57 2017 -0700

    [grunt/ftr] use named exports for configs

commit 7d7f38c7615cdbf8eb0119efc0f2a5188bca8792
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 18:50:04 2017 -0700

    [test] remove unnecessary directory definitions

commit 0c28984669768482f0a2ee7fc2800d5bcaf49025
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 18:46:29 2017 -0700

    [ftr/config] make default directories relative to config path

commit cd2f33612624cacffec138797f3fc0f4ecb46cca
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 18:32:12 2017 -0700

    [test/common] put server config into common

commit 7851ed811a236576c63bd20850b3ef2099be2a4e
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 18:18:20 2017 -0700

    [grunt] "deprecate" test:api:runner task

commit b2ac4c26593a1947c94f0168191fe8123ff74122
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 18:15:41 2017 -0700

    [ftr] accept the project name as an unnamed arg

commit 47e292894fc70c0a04883403c50c5d2ae0738d76
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 17:56:34 2017 -0700

    [ftr/grunt] convert ftr task to multi-task with config

commit 83375855f88e5e7b3fa8b6a1c5d24a9f54766ce5
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 17:54:54 2017 -0700

    [test/functional] move fixtures into test/functional project

commit 05994e9c92cf134c58f831c285b3b522a801acbc
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 17:02:51 2017 -0700

    [src/test_utils] merge with test/utils directory

commit c77ee5ed36b8b7eadf876cb6d9482a49dfc92b66
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 16:53:00 2017 -0700

    [test/api_integration] migrate api tests to functional test runner

commit ca328c34648dd7e07f70e1844e07cfc392e41103
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 16:50:12 2017 -0700

    [esArchiver] refresh modified indices after load

commit cde74a540850fd97578f441d6dccaefd1444e656
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 16:46:48 2017 -0700

    [test/functional] move shared services into test/common

commit 0ea2646aea5817f6d1595e6ae0d356c426f138f0
Author: spalger <spalger@users.noreply.github.com>
Date:   Mon May 15 22:51:23 2017 -0700

    [scripts/mocha] run _mocha script when debugging

commit 1cc80600d90e318d4738920aa557d124075a4570
Author: spalger <spalger@users.noreply.github.com>
Date:   Mon May 15 22:48:12 2017 -0700

    [ftr/config] allow child config files to have no testFiles config

commit 2bb6c957443b18cebc419baa6f9db301c8f4dc4f
Author: spalger <spalger@users.noreply.github.com>
Date:   Mon May 15 21:52:26 2017 -0700

    [ftr] move screenshots into test/functional
2017-05-17 18:53:45 -07:00
Spencer d126e7c5f4 Convert makelogs and mocha npm scripts (#11665)
* [scripts] convert `npm run makelogs` to script

* [scripts] convert `npm run mocha` to script

* [scripts] add warning to `test:ui:runner` npm script

* [script] fix location of scripts in warnings
2017-05-09 10:53:10 -07:00
Spencer 90434765c0 [functionalTestRunner] replace intern (#10910)
* [functional_test_runner] replace functional testing tools with custom/pluggable solution

* [functional_test_runner] Convert unit tests to commonjs format

* [functional_test_runner] Fix dashboard test in wrong mode

* [functional_test_runner] Add dashboardLandingPage test subject

* [functional_test_runner] Get Visualize page object

* [functional_test_runner] Fix outdated references

* [functional_test_runner] Fix more outdated refs

* [functional_test_runner] Remove duplicate tests

* [functional_test_runner] Improve test readability

* [functional_test_runner] 😞 So many duplicate methods

* [functional_test_runner] Move mgmt `before` outside toplevel describe

* [functional_test_runner] Settings page obj missing methods

* [functional_test_runner] Add improvements from @gammon

* [functional_test_runner] Fix return statements in async funcs

* [functional_test_runner] Move before() to correct scope

* [functional_test_runner] Add after() hooks to remove index patterns

* [functional_test_runner] Attempt to fix vertical bar chart tests

* [functional_test_runner] Clean up

* [functional_test_runner] Reinstate unit tests

* [functional_test_runner] Set default loglevel back to info

* [functional_test_runner] Replace `context`s with `describe`s

* [functional_test_runner] Better error handling

* [functional_test_runner] Add in new Tile Map tests

* Incorporate changes from master

* [functional_test_runner] validate that every test file has a single top-level suite

* Update contributing doc with link to full doc

* [docs] Spelling and grammar fixes

* docs: writing and running functional tests

* [docs] Move plugin doc to plugin area

* [docs] Housekeeping. Doc in wrong place

* [docs] Remove dup doc file

* [grunt] Only run mocha_setup when running tests, not every grunt task
2017-04-11 17:01:06 -05:00
Kim Joar Bekkelund 90be7e882f Move Jest test setup to root (#10963) 2017-04-05 21:24:01 -04:00
Spencer e67790037a [esArchiver] combine elasticDump and ScenarioManager (#10359)
* As a part of bringing functional testing to plugins, esArchiver gives these plugins a way to capture and reload es indexes without needing to write a bunch of custom code. It works similarly to the elasticDump and ScenarioManager tools that it replaces.

Differences:
  - Streaming implementation allows for much larger archives
  - CLI for creating and using archives
  - Configurable archive location
  - Stores the data in gzipped files (better for source control, searching, large archives)
  - Automatically identifies and upgrades Kibana config documents

Methods:
  - `#load(name)`: import an archive
  - `#loadIfNeeded(name)`: import an archive, but skip the documents what belong to any existing index
  - `#unload(name)`: delete the indexes stored in an archive

CLI operations:
  - `./bin/es_archiver save <name> [index patterns...]`: save the mapping and documents in one or more indexes that match the wild-card patterns into an the `<name>` archive
  - `./bin/es_archiver load <name>`: load the mapping and documents from the `<name>` archive

* [functional_tests/common/nagivate] check for statusPage

* [es_archiver] move bins into new scripts dir

* [functional_tests/apps/context] use esArchiver

* [esArchiver] general improvements after showing to a few folks

 - remove auto-upgrading config doc logic (until we have better access to kibana version info)
 - export unload command
 - remove preemptive checks in favor of reacting to errors
 - use type "doc" vs "hit" for doc records (consistency)
 - wrote a bunch of pending tests to think though and plan

* [esArchiver] make log a stream that writes to itself

* [esArchiver] fill in stats and archive format tests

* [esArchiver] splitup action logic

* [esArchiver/cli] fix cli --help output and comment

* [esArchiver] remove type-based param coercion

* [esArchiver/log] use strings for log levels

* [esArchvier] remove unused var

* [esArchiver/indexDocRecordsStream] add tests

* [esArchive] fill in remaining tests

* [esArchiver] fix dem tests

* [eslint] remove unused vars

* [esArchiver/loadIfNeeded] fix call to load()

* [esArchiver] remove loadDumpData helpers
2017-03-27 15:29:14 -04:00