x-pack/platform/plugins/shared/dataset_quality/README.md
In order to make ongoing maintenance of log collection easy we want to introduce the concept of data set quality, where users can easily get an overview on the data sets they have with information such as integration, size, last activity, among others.
Kibana primarily uses Jest for unit testing. Each plugin or package defines a jest.config.js that extends a preset provided by the @kbn/test package. The following command runs all Data Set Quality unit tests:
yarn jest --config x-pack/platform/plugins/shared/dataset_quality/jest.config.js
You can also run a specific test by passing the filepath as an argument, e.g.:
yarn jest --config x-pack/platform/plugins/shared/dataset_quality/jest.config.js x-pack/platform/plugins/shared/dataset_quality/server/routes/data_streams/get_data_streams/get_data_streams.test.ts
The deployment-agnostic API tests are located in x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/dataset_quality.
# start server
node scripts/functional_tests_server --config x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/stateful/oblt.stateful.config.ts
# run tests
node scripts/functional_test_runner --config x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/stateful/oblt.stateful.config.ts --include ./x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/dataset_quality/$
# start server
node scripts/functional_tests_server --config x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/serverless/oblt.serverless.config.ts
# run tests
node scripts/functional_test_runner --config x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/serverless/oblt.serverless.config.ts --include ./x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/dataset_quality/$
| Option | Description |
|---|---|
| --server | Only start ES and Kibana |
| --runner | Only run tests |
| --grep | Specify the specs to run |
| --grep-files | Specify the files to run |
| --inspect | Add --inspect-brk flag to the ftr for debugging |
| --times | Repeat the test n number of times |
The API tests are located in x-pack/solutions/observability/test/dataset_quality_api_integration/.
node x-pack/platform/plugins/shared/dataset_quality/scripts/api [--help]
The above command will start an ES instance on http://localhost:9220, a Kibana instance on http://localhost:5620 and run the api tests. Once the tests finish, the instances will be terminated.
# start server
node x-pack/platform/plugins/shared/dataset_quality/scripts/api --server
# run tests
node x-pack/platform/plugins/shared/dataset_quality/scripts/api --runner --grep-files=data_stream_settings.spec.ts
For tests using package registry we have enabled a configuration that uses a dockerized lite version to execute the tests in the CI, this will reduce the flakyness of them when calling the real endpoint.
To be able to run this version locally you must have a docker daemon running in your system and set FLEET_PACKAGE_REGISTRY_PORT env var. In order to set this variable execute
export set FLEET_PACKAGE_REGISTRY_PORT=12345
To unset the variable, and run the tests against the real endpoint again, execute
unset FLEET_PACKAGE_REGISTRY_PORT
yarn test:ftr:server --config ./x-pack/solutions/observability/test/functional/apps/dataset_quality/config.ts
yarn test:ftr:runner --config ./x-pack/solutions/observability/test/functional/apps/dataset_quality/config.ts --include ./x-pack/solutions/observability/test/functional/apps/dataset_quality/index.ts
yarn test:ftr:runner --config ./x-pack/solutions/observability/test/functional/apps/dataset_quality/config.ts --include ./x-pack/solutions/observability/test/functional/apps/dataset_quality/$1
yarn test:ftr:server --config ./x-pack/solutions/observability/test/serverless/functional/configs/config.ts
yarn test:ftr:runner --config ./x-pack/solutions/observability/test/serverless/functional/configs/config.ts --include ./x-pack/solutions/observability/test/serverless/functional/test_suites/dataset_quality/index.ts
yarn test:ftr:runner --config ./x-pack/solutions/observability/test/serverless/functional/configs/config.ts --include ./x-pack/solutions/observability/test/serverless/functional/test_suites/dataset_quality/$1