Skip to content

Commit

Permalink
Merge branch 'main' into fix-upgrade-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaElastic authored Oct 2, 2023
2 parents 87a460d + 007c341 commit 8b26d6f
Show file tree
Hide file tree
Showing 616 changed files with 19,521 additions and 4,157 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ packages/core/status/core-status-server-mocks @elastic/kibana-core
packages/core/test-helpers/core-test-helpers-deprecations-getters @elastic/kibana-core
packages/core/test-helpers/core-test-helpers-http-setup-browser @elastic/kibana-core
packages/core/test-helpers/core-test-helpers-kbn-server @elastic/kibana-core
packages/core/test-helpers/core-test-helpers-model-versions @elastic/kibana-core
packages/core/test-helpers/core-test-helpers-so-type-serializer @elastic/kibana-core
packages/core/test-helpers/core-test-helpers-test-utils @elastic/kibana-core
packages/core/theme/core-theme-browser @elastic/kibana-core
Expand Down Expand Up @@ -1239,6 +1240,7 @@ x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @elastic/kib
/x-pack/plugins/security_solution/public/common/components/ml_popover @elastic/security-detection-rule-management
/x-pack/plugins/security_solution/public/common/components/popover_items @elastic/security-detection-rule-management
/x-pack/plugins/security_solution/public/detection_engine/fleet_integrations @elastic/security-detection-rule-management
/x-pack/plugins/security_solution/public/detection_engine/endpoint_exceptions @elastic/security-defend-workflows
/x-pack/plugins/security_solution/public/detection_engine/rule_details_ui @elastic/security-detection-rule-management
/x-pack/plugins/security_solution/public/detection_engine/rule_management @elastic/security-detection-rule-management
/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui @elastic/security-detection-rule-management
Expand Down Expand Up @@ -1336,6 +1338,7 @@ x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @elastic/kib
/x-pack/test/security_solution_endpoint_api_int/ @elastic/security-defend-workflows
/x-pack/test_serverless/shared/lib/security/kibana_roles/ @elastic/security-defend-workflows
/x-pack/plugins/security_solution_serverless/public/upselling/sections/endpoint_management @elastic/security-defend-workflows
/x-pack/plugins/security_solution_serverless/public/upselling/pages/endpoint_management @elastic/security-defend-workflows
/x-pack/plugins/security_solution_serverless/server/endpoint @elastic/security-defend-workflows

## Security Solution sub teams - security-telemetry (Data Engineering)
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/create-deploy-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ jobs:
"<https://github.com/elastic/kibana/actions/runs/${{ github.run_id }}|GitHub Workflow run>",
"<https://buildkite.com/elastic/kibana-serverless-release/builds?branch=${{ env.TAG_NAME }}|Kibana Serverless Release pipeline>",
"<https://argo-workflows.us-central1.gcp.qa.cld.elstc.co/workflows?label=hash%3D${{ env.COMMIT }}|Argo Workflow> (use Elastic Cloud Staging VPN)",
"<https://overview.qa.cld.elstc.co/app/dashboards#/view/serverless-tooling-gpctl-deployment-status?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1d,to:now))&service-name=kibana&_a=(controlGroupInput:(chainingSystem:HIERARCHICAL,controlStyle:oneLine,ignoreParentSettings:(ignoreFilters:!f,ignoreQuery:!f,ignoreTimerange:!f,ignoreValidations:!f),panels:('18201b8e-3aae-4459-947d-21e007b6a3a5':(explicitInput:(dataViewId:'serverless.logs-*',enhancements:(),fieldName:commit-hash,id:'18201b8e-3aae-4459-947d-21e007b6a3a5',selectedOptions:!('${{ env.COMMIT }}'),title:commit-hash),grow:!t,order:1,type:optionsListControl,width:medium),'41060e65-ce4c-414e-b8cf-492ccb19245f':(explicitInput:(dataViewId:'serverless.logs-*',enhancements:(),fieldName:service-name,id:'41060e65-ce4c-414e-b8cf-492ccb19245f',selectedOptions:!(kibana),title:service-name),grow:!t,order:0,type:optionsListControl,width:medium),ed96828e-efe9-43ad-be3f-0e04218f79af:(explicitInput:(dataViewId:'serverless.logs-*',enhancements:(),fieldName:to-env,id:ed96828e-efe9-43ad-be3f-0e04218f79af,selectedOptions:!(qa),title:to-env),grow:!t,order:2,type:optionsListControl,width:medium))))|GPCTL Deployment Status dashboard>",
"<https://overview.qa.cld.elstc.co/app/dashboards#/view/serverless-tooling-gpctl-deployment-status?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1d,to:now))&service-name=kibana&_a=(controlGroupInput:(chainingSystem:HIERARCHICAL,controlStyle:oneLine,ignoreParentSettings:(ignoreFilters:!f,ignoreQuery:!f,ignoreTimerange:!f,ignoreValidations:!f),panels:('18201b8e-3aae-4459-947d-21e007b6a3a5':(explicitInput:(dataViewId:'serverless.logs-*',enhancements:(),fieldName:commit-hash,id:'18201b8e-3aae-4459-947d-21e007b6a3a5',selectedOptions:!('${{ env.COMMIT }}'),title:commit-hash),grow:!t,order:1,type:optionsListControl,width:medium),'41060e65-ce4c-414e-b8cf-492ccb19245f':(explicitInput:(dataViewId:'serverless.logs-*',enhancements:(),fieldName:service-name,id:'41060e65-ce4c-414e-b8cf-492ccb19245f',selectedOptions:!(kibana),title:service-name),grow:!t,order:0,type:optionsListControl,width:medium),ed96828e-efe9-43ad-be3f-0e04218f79af:(explicitInput:(dataViewId:'serverless.logs-*',enhancements:(),fieldName:to-env,id:ed96828e-efe9-43ad-be3f-0e04218f79af,selectedOptions:!(qa),title:to-env),grow:!t,order:2,type:optionsListControl,width:medium))))|GPCTL Deployment Status dashboard for nonprod >",
"<https://overview.elastic-cloud.com/app/dashboards#/view/serverless-tooling-gpctl-deployment-status?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1d,to:now))&service-name=kibana&_a=(controlGroupInput:(chainingSystem:HIERARCHICAL,controlStyle:oneLine,ignoreParentSettings:(ignoreFilters:!f,ignoreQuery:!f,ignoreTimerange:!f,ignoreValidations:!f),panels:('18201b8e-3aae-4459-947d-21e007b6a3a5':(explicitInput:(dataViewId:'serverless.logs-*',enhancements:(),fieldName:commit-hash,id:'18201b8e-3aae-4459-947d-21e007b6a3a5',selectedOptions:!('${{ env.COMMIT }}'),title:commit-hash),grow:!t,order:1,type:optionsListControl,width:medium),'41060e65-ce4c-414e-b8cf-492ccb19245f':(explicitInput:(dataViewId:'serverless.logs-*',enhancements:(),fieldName:service-name,id:'41060e65-ce4c-414e-b8cf-492ccb19245f',selectedOptions:!(kibana),title:service-name),grow:!t,order:0,type:optionsListControl,width:medium),ed96828e-efe9-43ad-be3f-0e04218f79af:(explicitInput:(dataViewId:'serverless.logs-*',enhancements:(),fieldName:to-env,id:ed96828e-efe9-43ad-be3f-0e04218f79af,selectedOptions:!(production),title:to-env),grow:!t,order:2,type:optionsListControl,width:medium))))|GPCTL Deployment Status dashboard>",
"<https://buildkite.com/elastic/kibana-tests/builds?branch=main|Quality Gate pipeline>"
]
- name: Post Slack failure message
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,8 @@
"jsts": "^1.6.2",
"kea": "^2.4.2",
"langchain": "^0.0.151",
"launchdarkly-js-client-sdk": "^2.22.1",
"launchdarkly-node-server-sdk": "^6.4.2",
"launchdarkly-js-client-sdk": "^3.1.4",
"launchdarkly-node-server-sdk": "^7.0.3",
"load-json-file": "^6.2.0",
"lodash": "^4.17.21",
"lru-cache": "^4.1.5",
Expand Down Expand Up @@ -1180,6 +1180,7 @@
"@kbn/core-saved-objects-server-mocks": "link:packages/core/saved-objects/core-saved-objects-server-mocks",
"@kbn/core-status-server-mocks": "link:packages/core/status/core-status-server-mocks",
"@kbn/core-test-helpers-kbn-server": "link:packages/core/test-helpers/core-test-helpers-kbn-server",
"@kbn/core-test-helpers-model-versions": "link:packages/core/test-helpers/core-test-helpers-model-versions",
"@kbn/core-theme-browser-mocks": "link:packages/core/theme/core-theme-browser-mocks",
"@kbn/core-ui-settings-browser-mocks": "link:packages/core/ui-settings/core-ui-settings-browser-mocks",
"@kbn/core-ui-settings-server-mocks": "link:packages/core/ui-settings/core-ui-settings-server-mocks",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# @kbn/core-test-helpers-model-versions

Package exposing utilities for model version integration testing.

This package exposes a `createModelVersionTestBed` utility which allow simulating
a testbed environment where we're in the cohabitation period between two versions, to test the interactions
between two model versions of a set of SO types.

### Limitations:

Because the test bed is only creating the parts of Core required to create the two SO
repositories, and because we're not loading all plugins (for proper isolation), the integration
test bed has some limitations:

- no extensions are enabled
- no security
- no encryption
- no spaces
- all SO types will be using the same SO index
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export { createModelVersionTestBed } from './src/test_bed';

export type {
ModelVersionTestBed,
ModelVersionTestKit,
ModelVersionTestkitOptions,
SavedObjectTestkitDefinition,
} from './src/types';
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/test-helpers/core-test-helpers-model-versions'],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "shared-common",
"id": "@kbn/core-test-helpers-model-versions",
"owner": "@elastic/kibana-core",
"devOnly": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@kbn/core-test-helpers-model-versions",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}
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
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { createTestServers, type TestElasticsearchUtils } from '@kbn/core-test-helpers-kbn-server';

/**
* Start the traditional ES cluster and return the instance.
*/
export const startElasticsearch = async ({
basePath,
dataArchive,
timeout,
}: {
basePath?: string;
dataArchive?: string;
timeout?: number;
} = {}): Promise<TestElasticsearchUtils> => {
const { startES } = createTestServers({
adjustTimeout: (t: number) => jest.setTimeout(t + (timeout ?? 0)),
settings: {
es: {
license: 'basic',
basePath,
dataArchive,
},
},
});
return await startES();
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { TestElasticsearchUtils } from '@kbn/core-test-helpers-kbn-server';
import { startElasticsearch } from './elasticsearch';
import { prepareModelVersionTestKit } from './test_kit';
import type { ModelVersionTestBed } from './types';

/**
* Create a {@link ModelVersionTestBed} that can be used for model version integration testing.
*
* @example
* ```ts
* describe('myIntegrationTest', () => {
* const testbed = createModelVersionTestBed();
* let testkit: ModelVersionTestKit;
*
* beforeAll(async () => {
* await testbed.startES();
* });
*
* afterAll(async () => {
* await testbed.stopES();
* });
*
* beforeEach(async () => {
* testkit = await testbed.prepareTestKit({
* savedObjectDefinitions: [{
* definition: mySoTypeDefinition,
* modelVersionBefore: 1,
* modelVersionAfter: 2,
* }]
* })
* });
*
* afterEach(async () => {
* if(testkit) {
* await testkit.tearsDown();
* }
* });
*
* it('can be used to test model version cohabitation', async () => {
* // last registered version is `1`
* const repositoryV1 = testkit.repositoryBefore;
* // last registered version is `2`
* const repositoryV2 = testkit.repositoryAfter;
*
* // do something with the two repositories, e.g
* await repositoryV1.create(someAttrs, { id });
* const v2docReadFromV1 = await repositoryV2.get('my-type', id);
* expect(v2docReadFromV1.attributes).toEqual(something);
* })
* })
* ```
*
* @public
*/
export const createModelVersionTestBed = (): ModelVersionTestBed => {
let elasticsearch: TestElasticsearchUtils | undefined;

const startES = async () => {
if (elasticsearch) {
throw new Error('Elasticsearch already started');
}
elasticsearch = await startElasticsearch();
};

const stopES = async () => {
if (!elasticsearch) {
throw new Error('Elasticsearch not started');
}
await elasticsearch.stop();
await delay(10);
elasticsearch = undefined;
};

return {
startES,
stopES,
prepareTestKit: prepareModelVersionTestKit,
};
};

const delay = (seconds: number) => new Promise((resolve) => setTimeout(resolve, seconds * 1000));
Loading

0 comments on commit 8b26d6f

Please sign in to comment.