kibana/x-pack
Jonathan Buttner e8a8f20932
[Security Solution] [Resolver] Supporting configurable ID (#84365)
* Trying to flesh out new tree route

* Working on the descendants query

* Almost working descendants

* Possible solution for aggs

* Working aggregations extraction

* Working on the ancestry array for descendants

* Making changes to the unique id for  ancestr

* Implementing ancestry funcitonality

* Deleting the multiple edges

* Fleshing out the descendants loop for levels

* Writing tests for ancestors and descendants

* Fixing type errors and writing more tests

* Renaming validation variable and deprecating old tree routes

* Renaming tree integration test file

* Adding some integration tests

* Fixing ancestry to handle multiple nodes in the request and writing more tests

* Adding more tests

* Renaming new tree to handler file

* Renaming new tree directory

* Adding more unit tests

* Using doc value fields and working on types

* Adding comments and more tests

* Fixing timestamp test issue

* Adding more comments

* Adding timerange and filters

* Updating schema

* Fixing timestamp test issue take 2

* Updating tests to use raw filter

* Adding time to generator

* Adding time filter and tests for retrieving lifecycles

* Removing min array size

* Updating the DAL

* Adding time range iso format

* Working on middleware

* Fleshing out middleware and actions

* Adding id, parent, and name fields to the top level response

* Adding logic for identifying when the view is moved

* WIP: updated data layers and selectors

* Switching to use isAnimating

* WIP: tree is displayed

* WIP: need events data for panel and fix tests

* Removing panning logic, adding comments and renaming things

* WIP: added name to graph

* Writing tests for the models

* Fixing generator start and end time generation

* Updating the mocks with the new interface

* Revert "Fixing generator start and end time generation"

This reverts commit c42ffd75c1.

* WIP: remove unnecessary front end data transformation

* Starting on loading state for nodes and details

* Find the terminated nodes in the middlewaree

* Fixing ingest tests

* Loading states seem to be working

* Removing some todos

* undo graphNodePositions naming

* Node loading state svg and pulse

* Fixing time range

* undo name changes, cleanup

* Creating mock that leverages the generator

* update tree generator

* log nested data in simulator.debugActions()

* change newResolverTree to resolverTree

* fix oneNodeWithPaginatedEvents mock and node events of type test

* Refactoring data reducer test and changing resolverTree DAL

* WIP: updating mocks

* remove deprecation tags

* Fixing the isometric tests

* Fixing process event tests

* updated resolver_tree mocks, update tests

* update additional tests

* fixing eslint

* fixing has more selectors

* update tests

* debugging click test

* Working node loading test

* Adding error cube and another test

* Adding a test for the error case

* use stored indices, update event api call for winlog, cleanup todos

* Adding more comments and restricting the analyze event to only endpoint and winlogbeat

* update to use schema provided by backend

* Fixing some type errors

* Fixing translation issue

* Fixing type errors

* Adding reload functionality

* Fixing translation issue

* Adding more tests for reload

* Cleaning comments up

* adding legend and schema info

* added legend and info popovers

* removed comment

* Adding comments and cleaning up stuff

* add schema and dataSource to mock actions

* Fixing some type errors and starting to address feedback

* Moving mock function

* Handling powershell events

* Adding test for winlogbeat schema

* remove cube loading className in favor of styledComponent

* fix closeAnalyzer jumping from middle of screen when resolver loads

* fix originID casing

* Cleaning up middleware and renaming time range

* Fixing node details test and some of the use selectors

* Fixing tests and types

* fix popover style, cube style, specific timestamp, some translations

* Fixed a test, and continuing to address feedback

* Addressing more feedback

* Refactoring the node data loading tests

* Adding selector for indices

* fix i18n, break apart graph controls, fix process event dot styles

* fix type error, styled description lists, nodeID

* style fix

* Removing unneeded test subjects

* recursion, recursion, recursion

* Calculating ancestors, descendants, generations once in factory and refactoring state

* Removing stringify replacer

* Adding default timerange to be beginning of epoch to max date in future

* refactoring winlog event query to use winlog record_id field

* fix popover toggle

* Fix type issue

* fix popover toggle

* add some tests

* fix types

* Adding link to time range comment

Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-09 12:44:59 -05:00
..
.github
build_chromium
dev-tools Jest multi-project configuration (#77894) 2020-12-02 11:42:23 -08:00
examples [Alerting UI] Replaced AlertsContextProvider with KibanaContextProvider and exposed components in API (#84604) 2020-12-07 16:44:40 -08:00
plugins [Security Solution] [Resolver] Supporting configurable ID (#84365) 2020-12-09 12:44:59 -05:00
scripts [Send To Background UI] Isolate functional test for wip feature (#84833) 2020-12-04 10:22:26 -07:00
tasks
test [Security Solution] [Resolver] Supporting configurable ID (#84365) 2020-12-09 12:44:59 -05:00
typings
.gitignore
.i18nrc.json
.telemetryrc.json
gulpfile.js
jest.config.js Jest multi-project configuration (#77894) 2020-12-02 11:42:23 -08:00
mocks.ts
package.json
README.md
tsconfig.json
tsconfig.refs.json

Elastic License Functionality

This directory tree contains files subject to the Elastic License. The files subject to the Elastic License are grouped in this directory to clearly separate them from files licensed under the Apache License 2.0.

Development

By default, Kibana will run with X-Pack installed as mentioned in the contributing guide.

Elasticsearch will run with a basic license. To run with a trial license, including security, you can specifying that with the yarn es command.

Example: yarn es snapshot --license trial --password changeme

By default, this will also set the password for native realm accounts to the password provided (changeme by default). This includes that of the kibana_system user which elasticsearch.username defaults to in development. If you wish to specify a password for a given native realm account, you can do that like so: --password.kibana_system=notsecure

Testing

Running specific tests

Test runner Test location Runner command (working directory is kibana/x-pack)
Jest x-pack/**/*.test.js
x-pack/**/*.test.ts
cd x-pack && node scripts/jest -t regexp [test path]
Functional x-pack/test/*integration/**/config.js
x-pack/test/*functional/config.js
x-pack/test/accessibility/config.js
node scripts/functional_tests_server --config x-pack/test/[directory]/config.js
node scripts/functional_test_runner --config x-pack/test/[directory]/config.js --grep=regexp

Examples:

  • Run the jest test case whose description matches 'filtering should skip values of null': cd x-pack && yarn test:jest -t 'filtering should skip values of null' plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js
  • Run the x-pack api integration test case whose description matches the given string: node scripts/functional_tests_server --config x-pack/test/api_integration/config.ts node scripts/functional_test_runner --config x-pack/test/api_integration/config.ts --grep='apis Monitoring Beats list with restarted beat instance should load multiple clusters'

In addition to to providing a regular expression argument, specific tests can also be run by appeding .only to an it or describe function block. E.g. describe( to describe.only(.

Running all tests

You can run unit tests by running:

yarn test

If you want to run tests only for a specific plugin (to save some time), you can run:

yarn test --plugins <plugin>[,<plugin>]*    # where <plugin> is "reporting", etc.

Running server unit tests

You can run mocha unit tests by running:

yarn test:mocha

Running functional tests

For more info, see the Elastic functional test development guide.

The functional UI tests, the API integration tests, and the SAML API integration tests are all run against a live browser, Kibana, and Elasticsearch install. Each set of tests is specified with a unique config that describes how to start the Elasticsearch server, the Kibana server, and what tests to run against them. The sets of tests that exist today are functional UI tests (specified by this config), API integration tests (specified by this config), and SAML API integration tests (specified by this config).

The script runs all sets of tests sequentially like so:

  • builds Elasticsearch and X-Pack
  • runs Elasticsearch with X-Pack
  • starts up the Kibana server with X-Pack
  • runs the functional UI tests against those servers
  • tears down the servers
  • repeats the same process for the API and SAML API integration test configs.

To do all of this in a single command run:

node scripts/functional_tests

Developing functional UI tests

If you are developing functional tests then you probably don't want to rebuild Elasticsearch and wait for all that setup on every test run, so instead use this command to build and start just the Elasticsearch and Kibana servers:

node scripts/functional_tests_server

After the servers are started, open a new terminal and run this command to run just the tests (without tearing down Elasticsearch or Kibana):

node scripts/functional_test_runner

For both of the above commands, it's crucial that you pass in --config to specify the same config file to both commands. This makes sure that the right tests will run against the right servers. Typically a set of tests and server configuration go together.

Read more about how the scripts work here.

For a deeper dive, read more about the way functional tests and servers work here.

Running API integration tests

API integration tests are run with a unique setup usually without UI assets built for the Kibana server.

API integration tests are intended to test only programmatic API exposed by Kibana. There is no need to run browser and simulate user actions, which significantly reduces execution time. In addition, the configuration for API integration tests typically sets optimize.enabled=false for Kibana because UI assets are usually not needed for these tests.

To run only the API integration tests:

node scripts/functional_tests --config test/api_integration/config

Running SAML API integration tests

We also have SAML API integration tests which set up Elasticsearch and Kibana with SAML support. Run only API integration tests with SAML enabled like so:

node scripts/functional_tests --config test/security_api_integration/saml.config

Running Jest integration tests

Jest integration tests can be used to test behavior with Elasticsearch and the Kibana server.

node scripts/jest_integration

An example test exists at test_utils/jest/integration_tests/example_integration.test.ts

Running Reporting functional tests

See here for more information on running reporting tests.