## Summary Fixes https://github.com/elastic/kibana/issues/159410 This PR adds a new package `kbn-generate-console-definitions` that will eventually replace the package `kbn-spec-to-console`. It also adds a new command to use the script in the new package. The new command can be used as following: - `node scripts/generate_console_definitions.js --source <PATH_TO_ES_SPECIFICATION_REPO>` where `PATH_TO_ES_SPECIFICATION_FOLDER` is the absolute path to the root of the [ES specification repo](https://github.com/elastic/elasticsearch-specification), for example `/Users/yulia/elastic/elasticsearch-specification`. This command will generate autocomplete definitions in the folder `KIBANA_ROOT/src/plugins/console/server/lib/json/generated`. - Optionally `--dest` parameter can be passed to generate definitions in a different folder, relative to `KIBANA_ROOT`. Basic script functionality was implemented in this PR: - [x] Create the folder if doesn't exist yet - [x] Remove all files in the folder before generating definitions - [x] Load the specification schema and parse each endpoint - [x] Create a file for each endpoint with the endpoint name, methods, patterns and doc urls. Functionality that will be added in follow up PRs: - Url paramaters - Request body parameters - Availability property - Unit test for script functions ### How to test 1. Checkout ES specification repo 2. Run the command with `node scripts/generate_console_definitions.js --source <ES_SPECIFICATION_REPO> --emptyDest` where `<ES_SPECIFICATION_REPO>` is the absolute path to the root of the ES specification repo 3. Check the changes to the generated files in the folder `/KIBANA_REPO/src/plugins/console/server/lib/spec_definitions/json/generated` and make sure they have a correct endpoint name, patterns, methods and doc links. We are not generating any url params, request body params or availability property for now. 4. Change the constant in the file `KIBANA_REPO/src/plugins/console/common/constants/autocomplete_definitions.ts` to a non-existent folder. Run the script `node scripts/generate_console_definitions.js --source <ES_SPECIFICATION_REPO>` and check that the folder has been created successfully 5. Re-run the command without `--emptyDest` flag targeting a folder that already contain some files. Check that the script fails and doesn't silently remove existing files 6. Run the help command `node scripts/generate_console_definitions.js --help` and check if the help message makes sense --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com> |
||
---|---|---|
.. | ||
archive_migration_functions.sh | ||
backport.js | ||
build.js | ||
build_api_docs.js | ||
build_kibana_platform_plugins.js | ||
build_plugin_list_docs.js | ||
check_file_casing.js | ||
check_ftr_configs.js | ||
check_jest_configs.js | ||
check_licenses.js | ||
check_mappings_update.js | ||
chromium_version.js | ||
classify_source.js | ||
delete_kibana_indices.sh | ||
dev_docs.sh | ||
docs.js | ||
download_pr_list.js | ||
enabled_ftr_configs.js | ||
es.js | ||
es_archiver.js | ||
eslint.js | ||
eslint_with_types.js | ||
extract_performance_testing_dataset.js | ||
find_babel_runtime_helpers_in_use.js | ||
find_node_libs_browser_polyfills_in_use.js | ||
functional_test_runner.js | ||
functional_tests.js | ||
functional_tests_server.js | ||
generate.js | ||
generate_console_definitions.js | ||
generate_plugin.js | ||
generate_team_assignments.js | ||
i18n_check.js | ||
i18n_extract.js | ||
i18n_integrate.js | ||
ingest_coverage.js | ||
jest.js | ||
jest_integration.js | ||
kbn.js | ||
kbn_archiver.js | ||
kibana.js | ||
kibana_encryption_keys.js | ||
kibana_keystore.js | ||
kibana_plugin.js | ||
kibana_setup.js | ||
kibana_verification_code.js | ||
licenses_csv_report.js | ||
lint_packages.js | ||
lint_ts_projects.js | ||
makelogs.js | ||
notice.js | ||
plugin_helpers.js | ||
precommit_hook.js | ||
read_jest_help.mjs | ||
README.md | ||
register_git_hook.js | ||
report_failed_tests.js | ||
report_performance_metrics.js | ||
run_performance.js | ||
run_scalability.js | ||
saved_objs_info.js | ||
ship_ci_stats.js | ||
spec_to_console.js | ||
storybook.js | ||
stylelint.js | ||
synthtrace.js | ||
telemetry_check.js | ||
telemetry_extract.js | ||
test_hardening.js | ||
type_check.js | ||
update_prs.js | ||
update_vscode_config.js | ||
validate_next_docs.js | ||
whereis_pkg.js |
Kibana Dev Scripts
This directory contains scripts useful for interacting with Kibana tools in development. Use the node executable and --help
flag to learn about how they work:
node scripts/{{script name}} --help
For Developers
This directory is excluded from the build and tools within it should help users discover their capabilities. Each script in this directory must:
- require
src/setup_node_env
to bootstrap NodeJS environment - call out to source code in the
src
orpackages
directories - react to the
--help
flag - run everywhere OR check and fail fast when a required OS or toolchain is not available
Functional Test Scripts
node scripts/functional_tests [--config test/functional/config.base.js --config test/api_integration/config.js]
Runs all the functional tests: selenium tests and api integration tests. List configs with multiple --config
arguments. Uses the @kbn/test library to run Elasticsearch and Kibana servers and tests against those servers, for multiple server+test setups. In particular, calls out to runTests()
. Can be run on a single config.
node scripts/functional_tests_server [--config test/functional/config.base.js]
Starts just the Elasticsearch and Kibana servers given a single config, i.e. via --config test/functional/config.base.js
or --config test/api_integration/config
. Allows the user to start just the servers with this script, and keep them running while running tests against these servers. The idea is that the same config file configures both Elasticsearch and Kibana servers. Uses the startServers()
method from @kbn/test library.
Example. Start servers and run tests, separately, but using the same config:
# Just the servers
node scripts/functional_tests_server --config path/to/config
In another terminal:
# Just the tests--against the running servers
node scripts/functional_test_runner --config path/to/config
For details on how the internal methods work, read this readme.
ES archiver
Loading data
If you wish to load up specific es archived data for your test, you can do so via:
node scripts/es_archiver.js load <archive> [--es-url=http://username:password@localhost:9200] [--kibana-url=http://username:password@localhost:5601/{basepath?}]
That will load the specified archive located in the archive directory specified by the default functional config file, located in test/functional/config.base.js
. To load archives from other function config files you can pass --config path/to/config.js
.
Note: The --es-url
and --kibana-url
options may or may not be neccessary depending on your current Kibana configuration settings, and their values
may also change based on those settings (for example if you are not running with security you will not need the username:password
portion).
Saving data
You can save existing data into an archive by using the save
command:
node scripts/es_archiver.js save <archive name for kibana data> [space separated list of index patterns to include]
You may want to store the .kibana index separate from data. Since adding a lot of data will bloat our repo size, we have many tests that reuse the same
data indices but use their own .kibana
index.