Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into security-solution-t…
Browse files Browse the repository at this point in the history
…grid-own-state

# Conflicts:
#	x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx
  • Loading branch information
YulNaumenko committed Oct 18, 2022
2 parents 59e2944 + 2b11ca7 commit 667a7f7
Show file tree
Hide file tree
Showing 185 changed files with 7,700 additions and 1,347 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,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-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
packages/core/theme/core-theme-browser-internal @elastic/kibana-core
packages/core/theme/core-theme-browser-mocks @elastic/kibana-core
Expand Down Expand Up @@ -989,6 +990,9 @@ packages/shared-ux/card/no_data/types @elastic/shared-ux
packages/shared-ux/link/redirect_app/impl @elastic/shared-ux
packages/shared-ux/link/redirect_app/mocks @elastic/shared-ux
packages/shared-ux/link/redirect_app/types @elastic/shared-ux
packages/shared-ux/markdown/impl @elastic/shared-ux
packages/shared-ux/markdown/mocks @elastic/shared-ux
packages/shared-ux/markdown/types @elastic/shared-ux
packages/shared-ux/page/analytics_no_data/impl @elastic/shared-ux
packages/shared-ux/page/analytics_no_data/mocks @elastic/shared-ux
packages/shared-ux/page/analytics_no_data/types @elastic/shared-ux
Expand Down
13 changes: 12 additions & 1 deletion docs/settings/fleet-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ Refer to {fleet-guide}/air-gapped.html[Air-gapped environments] for details.

`xpack.fleet.agents.fleet_server.hosts`::
Hostnames used by {agent} for accessing {fleet-server}.
+
If configured in your `kibana.yml`, this setting is grayed out and unavailable
in the {fleet} UI. To make this setting editable in the UI, do not configure it
in the configuration file.

`xpack.fleet.agents.elasticsearch.hosts`::
Hostnames used by {agent} for accessing {es}.
Expand All @@ -52,6 +56,9 @@ Hash pin used for certificate verification. The pin is a base64-encoded string o
Use these settings to pre-define integrations and agent policies that you
want {fleet} to load up by default.

NOTE: These settings are not supported to pre-configure the Endpoint and Cloud
Security integration.

`xpack.fleet.packages`::
List of integrations that are installed when the {fleet} app starts up for the first time.
+
Expand Down Expand Up @@ -126,7 +133,11 @@ List of agent policies that are configured when the {fleet} app starts.
=====

`xpack.fleet.outputs`::
List of outputs that are configured when the {fleet} app starts.
List of outputs that are configured when the {fleet} app starts.
+
If configured in your `kibana.yml`, output settings are grayed out and
unavailable in the {fleet} UI. To make these settings editable in the UI, do not
configure them in the configuration file.
+
.Required properties of `xpack.fleet.outputs`
[%collapsible%open]
Expand Down
2 changes: 2 additions & 0 deletions docs/user/api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ For example:
`GET kbn:/api/index_management/indices`
--------------------------------------------------

Note: this will automatically prefix `s/{space_id}/` on the API request if ran from a non-default Kibana Space.

[float]
[[api-authentication]]
=== Authentication
Expand Down
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@
"@kbn/core-test-helpers-deprecations-getters": "link:bazel-bin/packages/core/test-helpers/core-test-helpers-deprecations-getters",
"@kbn/core-test-helpers-http-setup-browser": "link:bazel-bin/packages/core/test-helpers/core-test-helpers-http-setup-browser",
"@kbn/core-test-helpers-so-type-serializer": "link:bazel-bin/packages/core/test-helpers/core-test-helpers-so-type-serializer",
"@kbn/core-test-helpers-test-utils": "link:bazel-bin/packages/core/test-helpers/core-test-helpers-test-utils",
"@kbn/core-theme-browser": "link:bazel-bin/packages/core/theme/core-theme-browser",
"@kbn/core-theme-browser-internal": "link:bazel-bin/packages/core/theme/core-theme-browser-internal",
"@kbn/core-theme-browser-mocks": "link:bazel-bin/packages/core/theme/core-theme-browser-mocks",
Expand Down Expand Up @@ -372,6 +373,9 @@
"@kbn/shared-ux-link-redirect-app": "link:bazel-bin/packages/shared-ux/link/redirect_app/impl",
"@kbn/shared-ux-link-redirect-app-mocks": "link:bazel-bin/packages/shared-ux/link/redirect_app/mocks",
"@kbn/shared-ux-link-redirect-app-types": "link:bazel-bin/packages/shared-ux/link/redirect_app/types",
"@kbn/shared-ux-markdown": "link:bazel-bin/packages/shared-ux/markdown/impl",
"@kbn/shared-ux-markdown-mocks": "link:bazel-bin/packages/shared-ux/markdown/mocks",
"@kbn/shared-ux-markdown-types": "link:bazel-bin/packages/shared-ux/markdown/types",
"@kbn/shared-ux-page-analytics-no-data": "link:bazel-bin/packages/shared-ux/page/analytics_no_data/impl",
"@kbn/shared-ux-page-analytics-no-data-mocks": "link:bazel-bin/packages/shared-ux/page/analytics_no_data/mocks",
"@kbn/shared-ux-page-analytics-no-data-types": "link:bazel-bin/packages/shared-ux/page/analytics_no_data/types",
Expand Down Expand Up @@ -1030,6 +1034,7 @@
"@types/kbn__core-test-helpers-deprecations-getters": "link:bazel-bin/packages/core/test-helpers/core-test-helpers-deprecations-getters/npm_module_types",
"@types/kbn__core-test-helpers-http-setup-browser": "link:bazel-bin/packages/core/test-helpers/core-test-helpers-http-setup-browser/npm_module_types",
"@types/kbn__core-test-helpers-so-type-serializer": "link:bazel-bin/packages/core/test-helpers/core-test-helpers-so-type-serializer/npm_module_types",
"@types/kbn__core-test-helpers-test-utils": "link:bazel-bin/packages/core/test-helpers/core-test-helpers-test-utils/npm_module_types",
"@types/kbn__core-theme-browser": "link:bazel-bin/packages/core/theme/core-theme-browser/npm_module_types",
"@types/kbn__core-theme-browser-internal": "link:bazel-bin/packages/core/theme/core-theme-browser-internal/npm_module_types",
"@types/kbn__core-theme-browser-mocks": "link:bazel-bin/packages/core/theme/core-theme-browser-mocks/npm_module_types",
Expand Down Expand Up @@ -1131,6 +1136,9 @@
"@types/kbn__shared-ux-link-redirect-app": "link:bazel-bin/packages/shared-ux/link/redirect_app/impl/npm_module_types",
"@types/kbn__shared-ux-link-redirect-app-mocks": "link:bazel-bin/packages/shared-ux/link/redirect_app/mocks/npm_module_types",
"@types/kbn__shared-ux-link-redirect-app-types": "link:bazel-bin/packages/shared-ux/link/redirect_app/types/npm_module_types",
"@types/kbn__shared-ux-markdown": "link:bazel-bin/packages/shared-ux/markdown/impl/npm_module_types",
"@types/kbn__shared-ux-markdown-mocks": "link:bazel-bin/packages/shared-ux/markdown/mocks/npm_module_types",
"@types/kbn__shared-ux-markdown-types": "link:bazel-bin/packages/shared-ux/markdown/types/npm_module_types",
"@types/kbn__shared-ux-page-analytics-no-data": "link:bazel-bin/packages/shared-ux/page/analytics_no_data/impl/npm_module_types",
"@types/kbn__shared-ux-page-analytics-no-data-mocks": "link:bazel-bin/packages/shared-ux/page/analytics_no_data/mocks/npm_module_types",
"@types/kbn__shared-ux-page-analytics-no-data-types": "link:bazel-bin/packages/shared-ux/page/analytics_no_data/types/npm_module_types",
Expand Down
8 changes: 8 additions & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ filegroup(
"//packages/core/test-helpers/core-test-helpers-deprecations-getters:build",
"//packages/core/test-helpers/core-test-helpers-http-setup-browser:build",
"//packages/core/test-helpers/core-test-helpers-so-type-serializer:build",
"//packages/core/test-helpers/core-test-helpers-test-utils:build",
"//packages/core/theme/core-theme-browser:build",
"//packages/core/theme/core-theme-browser-internal:build",
"//packages/core/theme/core-theme-browser-mocks:build",
Expand Down Expand Up @@ -315,6 +316,9 @@ filegroup(
"//packages/shared-ux/link/redirect_app/impl:build",
"//packages/shared-ux/link/redirect_app/mocks:build",
"//packages/shared-ux/link/redirect_app/types:build",
"//packages/shared-ux/markdown/impl:build",
"//packages/shared-ux/markdown/mocks:build",
"//packages/shared-ux/markdown/types:build",
"//packages/shared-ux/page/analytics_no_data/impl:build",
"//packages/shared-ux/page/analytics_no_data/mocks:build",
"//packages/shared-ux/page/analytics_no_data/types:build",
Expand Down Expand Up @@ -503,6 +507,7 @@ filegroup(
"//packages/core/test-helpers/core-test-helpers-deprecations-getters:build_types",
"//packages/core/test-helpers/core-test-helpers-http-setup-browser:build_types",
"//packages/core/test-helpers/core-test-helpers-so-type-serializer:build_types",
"//packages/core/test-helpers/core-test-helpers-test-utils:build_types",
"//packages/core/theme/core-theme-browser:build_types",
"//packages/core/theme/core-theme-browser-internal:build_types",
"//packages/core/theme/core-theme-browser-mocks:build_types",
Expand Down Expand Up @@ -639,6 +644,9 @@ filegroup(
"//packages/shared-ux/card/no_data/mocks:build_types",
"//packages/shared-ux/link/redirect_app/impl:build_types",
"//packages/shared-ux/link/redirect_app/mocks:build_types",
"//packages/shared-ux/markdown/impl:build_types",
"//packages/shared-ux/markdown/mocks:build_types",
"//packages/shared-ux/markdown/types:build_types",
"//packages/shared-ux/page/analytics_no_data/impl:build_types",
"//packages/shared-ux/page/analytics_no_data/mocks:build_types",
"//packages/shared-ux/page/kibana_no_data/impl:build_types",
Expand Down
126 changes: 126 additions & 0 deletions packages/core/test-helpers/core-test-helpers-test-utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")

PKG_DIRNAME = "core-test-helpers-test-utils"
PKG_REQUIRE_NAME = "@kbn/core-test-helpers-test-utils"

SOURCE_FILES = glob(
[
"**/*.ts",
],
exclude = [
"**/*.config.js",
"**/*.mock.*",
"**/*.test.*",
"**/*.stories.*",
"**/__snapshots__/**",
"**/integration_tests/**",
"**/mocks/**",
"**/scripts/**",
"**/storybook/**",
"**/test_fixtures/**",
"**/test_helpers/**",
],
)

SRCS = SOURCE_FILES

filegroup(
name = "srcs",
srcs = SRCS,
)

NPM_MODULE_EXTRA_FILES = [
"package.json",
]

RUNTIME_DEPS = [
"//packages/core/deprecations/core-deprecations-server-mocks",
"//packages/core/execution-context/core-execution-context-server-mocks",
"//packages/core/elasticsearch/core-elasticsearch-server-mocks",
"//packages/core/http/core-http-context-server-internal",
"//packages/core/http/core-http-context-server-mocks",
"//packages/core/http/core-http-server-mocks",
"//packages/core/saved-objects/core-saved-objects-api-server-mocks",
"//packages/core/saved-objects/core-saved-objects-base-server-mocks",
"//packages/core/saved-objects/core-saved-objects-server-mocks",
"//packages/core/ui-settings/core-ui-settings-server-mocks",
]

TYPES_DEPS = [
"@npm//@types/node",
"@npm//@types/jest",
"//packages/core/deprecations/core-deprecations-server-mocks:npm_module_types",
"//packages/core/execution-context/core-execution-context-server-mocks:npm_module_types",
"//packages/core/elasticsearch/core-elasticsearch-server-mocks:npm_module_types",
"//packages/core/http/core-http-context-server-internal:npm_module_types",
"//packages/core/http/core-http-context-server-mocks:npm_module_types",
"//packages/core/http/core-http-server-mocks:npm_module_types",
"//packages/core/saved-objects/core-saved-objects-api-server-mocks:npm_module_types",
"//packages/core/saved-objects/core-saved-objects-base-server-mocks:npm_module_types",
"//packages/core/saved-objects/core-saved-objects-server:npm_module_types",
"//packages/core/saved-objects/core-saved-objects-server-mocks:npm_module_types",
"//packages/core/ui-settings/core-ui-settings-server-mocks:npm_module_types",
]

jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)

ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.bazel.json",
],
)

ts_project(
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = TYPES_DEPS,
declaration = True,
declaration_map = True,
emit_declaration_only = True,
out_dir = "target_types",
tsconfig = ":tsconfig",
)

js_library(
name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)

pkg_npm(
name = "npm_module",
deps = [":" + PKG_DIRNAME],
)

filegroup(
name = "build",
srcs = [":npm_module"],
visibility = ["//visibility:public"],
)

pkg_npm_types(
name = "npm_module_types",
srcs = SRCS,
deps = [":tsc_types"],
package_name = PKG_REQUIRE_NAME,
tsconfig = ":tsconfig",
visibility = ["//visibility:public"],
)

filegroup(
name = "build_types",
srcs = [":npm_module_types"],
visibility = ["//visibility:public"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/core-test-helpers-test-utils

This package contains Core's server-side test utils.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@
* Side Public License, v 1.
*/

export { createHttpServer } from '@kbn/core-http-server-mocks';
export { setupServer } from './integration_tests/saved_objects/routes/test_utils';
export {
getDeprecationsFor,
getDeprecationsForGlobalSettings,
} from '@kbn/core-test-helpers-deprecations-getters';
export { setupServer } from './src/setup_server';
export { createExportableType } from './src/create_exportable_type';
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-test-utils'],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-test-helpers-test-utils",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": [],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@kbn/core-test-helpers-test-utils",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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 type { SavedObjectsType } from '@kbn/core-saved-objects-server';
export const createExportableType = (name: string): SavedObjectsType => {
return {
name,
hidden: false,
namespaceType: 'single',
mappings: {
properties: {},
},
management: {
importableAndExportable: true,
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,36 @@
import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
import { ContextService } from '@kbn/core-http-context-server-internal';
import { createHttpServer, createCoreContext } from '@kbn/core-http-server-mocks';
import type { SavedObjectsType } from '@kbn/core-saved-objects-server';
import { contextServiceMock, coreMock } from '../../../mocks';
import { contextServiceMock } from '@kbn/core-http-context-server-mocks';
import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks';
import { typeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks';
import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks';
import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
import { deprecationsServiceMock } from '@kbn/core-deprecations-server-mocks';

const defaultCoreId = Symbol('core');

function createCoreServerRequestHandlerContextMock() {
return {
savedObjects: {
client: savedObjectsClientMock.create(),
typeRegistry: typeRegistryMock.create(),
getClient: savedObjectsClientMock.create,
getExporter: savedObjectsServiceMock.createExporter,
getImporter: savedObjectsServiceMock.createImporter,
},
elasticsearch: {
client: elasticsearchServiceMock.createScopedClusterClient(),
},
uiSettings: {
client: uiSettingsServiceMock.createClient(),
},
deprecations: {
client: deprecationsServiceMock.createClient(),
},
};
}
export const setupServer = async (coreId: symbol = defaultCoreId) => {
const coreContext = createCoreContext({ coreId });
const contextService = new ContextService(coreContext);
Expand All @@ -24,7 +49,7 @@ export const setupServer = async (coreId: symbol = defaultCoreId) => {
context: contextService.setup({ pluginDependencies: new Map() }),
executionContext: executionContextServiceMock.createInternalSetupContract(),
});
const handlerContext = coreMock.createRequestHandlerContext();
const handlerContext = createCoreServerRequestHandlerContextMock();

httpSetup.registerRouteHandlerContext<any, 'core'>(coreId, 'core', (ctx, req, res) => {
return handlerContext;
Expand All @@ -36,17 +61,3 @@ export const setupServer = async (coreId: symbol = defaultCoreId) => {
handlerContext,
};
};

export const createExportableType = (name: string): SavedObjectsType => {
return {
name,
hidden: false,
namespaceType: 'single',
mappings: {
properties: {},
},
management: {
importableAndExportable: true,
},
};
};
Loading

0 comments on commit 667a7f7

Please sign in to comment.