-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Use docker for endpoint tests (#73092)
* Copying api integration tests into their own directory * Removing api integration tests and using ingest docker image * Fixing typo * Fixing type errors and empty string and reenabling tests * Rebuilding docs * Renaming url override variable Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
dd4796c
commit 867a672
Showing
22 changed files
with
341 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# Security Solution | ||
|
||
Welcome to the Kibana Security Solution plugin! This README will go over getting started with development and testing. | ||
|
||
## Development | ||
|
||
## Tests | ||
|
||
The endpoint specific tests leverage the ingest manager to install the endpoint package. Before the api integration | ||
and functional tests are run the ingest manager is initialized. This initialization process includes reaching out to | ||
a package registry service to install the endpoint package. The endpoint tests support three different ways to run | ||
the tests given the constraint on an available package registry. | ||
|
||
1. Using Docker | ||
2. Running your own local package registry | ||
3. Using the default external package registry | ||
|
||
These scenarios will be outlined the sections below. | ||
|
||
### Endpoint API Integration Tests Location | ||
|
||
The endpoint api integration tests are located [here](../../test/security_solution_endpoint_api_int) | ||
|
||
### Endpoint Functional Tests Location | ||
|
||
The endpoint functional tests are located [here](../../test/security_solution_endpoint) | ||
|
||
### Using Docker | ||
|
||
To run the tests using the recommended docker image version you must have `docker` installed. The testing infrastructure | ||
will stand up a docker container using the image defined [here](../../test/ingest_manager_api_integration/config.ts#L15) | ||
|
||
Make sure you're in the Kibana root directory. | ||
|
||
#### Endpoint API Integration Tests | ||
|
||
In one terminal, run: | ||
|
||
```bash | ||
INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:server --config x-pack/test/security_solution_endpoint_api_int/config.ts | ||
``` | ||
|
||
In another terminal, run: | ||
|
||
```bash | ||
INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:runner --config x-pack/test/security_solution_endpoint_api_int/config.ts | ||
``` | ||
|
||
#### Endpoint Functional Tests | ||
|
||
In one terminal, run: | ||
|
||
```bash | ||
INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:server --config x-pack/test/security_solution_endpoint/config.ts | ||
``` | ||
|
||
In another terminal, run: | ||
|
||
```bash | ||
INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:runner --config x-pack/test/security_solution_endpoint/config.ts | ||
``` | ||
|
||
### Running your own package registry | ||
|
||
If you are doing endpoint package development it will be useful to run your own package registry to serve the latest package you're building. | ||
To do this use the following commands: | ||
|
||
Make sure you're in the Kibana root directory. | ||
|
||
#### Endpoint API Integration Tests | ||
|
||
In one terminal, run: | ||
|
||
```bash | ||
PACKAGE_REGISTRY_URL_OVERRIDE=<url to your package registry like http://localhost:8080> yarn test:ftr:server --config x-pack/test/security_solution_endpoint_api_int/config.ts | ||
``` | ||
|
||
In another terminal, run: | ||
|
||
```bash | ||
PACKAGE_REGISTRY_URL_OVERRIDE=<url to your package registry like http://localhost:8080> yarn test:ftr:runner --config x-pack/test/security_solution_endpoint_api_int/config.ts | ||
``` | ||
|
||
#### Endpoint Functional Tests | ||
|
||
In one terminal, run: | ||
|
||
```bash | ||
PACKAGE_REGISTRY_URL_OVERRIDE=<url to your package registry like http://localhost:8080> yarn test:ftr:server --config x-pack/test/security_solution_endpoint/config.ts | ||
``` | ||
|
||
In another terminal, run: | ||
|
||
```bash | ||
PACKAGE_REGISTRY_URL_OVERRIDE=<url to your package registry like http://localhost:8080> yarn test:ftr:runner --config x-pack/test/security_solution_endpoint/config.ts | ||
``` | ||
|
||
### Using the default public registry | ||
|
||
If you don't have docker installed and don't want to run your own registry, you can run the tests using the ingest manager's default public package registry. The actual package registry used is [here](../../plugins/ingest_manager/common/constants/epm.ts#L9) | ||
|
||
Make sure you're in the Kibana root directory. | ||
|
||
#### Endpoint API Integration Tests | ||
|
||
In one terminal, run: | ||
|
||
```bash | ||
yarn test:ftr:server --config x-pack/test/security_solution_endpoint_api_int/config.ts | ||
``` | ||
|
||
In another terminal, run: | ||
|
||
```bash | ||
yarn test:ftr:runner --config x-pack/test/security_solution_endpoint_api_int/config.ts | ||
``` | ||
|
||
#### Endpoint Functional Tests | ||
|
||
In one terminal, run: | ||
|
||
```bash | ||
yarn test:ftr:server --config x-pack/test/security_solution_endpoint/config.ts | ||
``` | ||
|
||
In another terminal, run: | ||
|
||
```bash | ||
yarn test:ftr:runner --config x-pack/test/security_solution_endpoint/config.ts | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
x-pack/test/security_solution_endpoint_api_int/apis/fixtures/package_registry_config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
package_paths: | ||
- /packages/production |
34 changes: 34 additions & 0 deletions
34
x-pack/test/security_solution_endpoint_api_int/apis/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { FtrProviderContext } from '../ftr_provider_context'; | ||
import { isRegistryEnabled, getRegistryUrl } from '../registry'; | ||
import { DEFAULT_REGISTRY_URL } from '../../../plugins/ingest_manager/common'; | ||
|
||
export default function endpointAPIIntegrationTests(providerContext: FtrProviderContext) { | ||
const { loadTestFile, getService } = providerContext; | ||
|
||
describe('Endpoint plugin', function () { | ||
const ingestManager = getService('ingestManager'); | ||
|
||
this.tags('ciGroup7'); | ||
const log = getService('log'); | ||
|
||
if (!isRegistryEnabled()) { | ||
log.warning('These tests are being run with an external package registry'); | ||
} | ||
|
||
const registryUrl = getRegistryUrl() ?? DEFAULT_REGISTRY_URL; | ||
log.info(`Package registry URL for tests: ${registryUrl}`); | ||
|
||
before(async () => { | ||
await ingestManager.setup(); | ||
}); | ||
loadTestFile(require.resolve('./resolver')); | ||
loadTestFile(require.resolve('./metadata')); | ||
loadTestFile(require.resolve('./policy')); | ||
loadTestFile(require.resolve('./artifacts')); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.