mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 10:40:07 -04:00
Move real plugins out of 'fixtures' dirs (#148756)
The location of plugins was previously somewhat irrelevant, but as we move into packages it's more important that we can find all plugins in the repository, and we would like to be able to do that without needing to maintain a manifest somewhere to accomplish this. In order to make this possible we plan to find any plugin/package by spotting all kibana.json files which are not "fixtures". This allows plugin-like code (but not actual plugin code) to exist for testing purposes, but it must be within some form of "fixtures" directory, and any plugin that isn't in a fixtures directory will be automatically pulled into the system (though test plugins, examples, etc. will still only be loaded when the plugin's path is passed via `--plugin-path`, the system will know about them and use that knowledge for other things). Since this is just a rename Operations will review and merge by EOD Jan 12th unless someone has a blocking concern. Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
ce026d3678
commit
c8f83ed2eb
234 changed files with 312 additions and 246 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -381,7 +381,7 @@
|
|||
/x-pack/test/plugin_api_integration/test_suites/task_manager/ @elastic/response-ops
|
||||
/x-pack/plugins/triggers_actions_ui/ @elastic/response-ops
|
||||
/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/ @elastic/response-ops
|
||||
/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/ @elastic/response-ops
|
||||
/x-pack/test/functional_with_es_ssl/plugins/alerts/ @elastic/response-ops
|
||||
/docs/user/alerting/ @elastic/response-ops
|
||||
/docs/management/connectors/ @elastic/response-ops
|
||||
/x-pack/plugins/stack_alerts/ @elastic/response-ops
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -115,3 +115,4 @@ fleet-server.yml
|
|||
/packages/kbn-synthetic-package-map/
|
||||
**/.synthetics/
|
||||
**/.journeys/
|
||||
x-pack/test/security_api_integration/plugins/audit_log/audit.log
|
||||
|
|
|
@ -98,7 +98,7 @@ function validateProjectOwnership(
|
|||
if (isNotInTsProject.length) {
|
||||
failed = true;
|
||||
log.error(
|
||||
`The following files do not belong to a tsconfig.json file, or that tsconfig.json file is not listed in packages/kbn-ts-projects/projects.ts\n${isNotInTsProject
|
||||
`The following files do not belong to a tsconfig.json file\n${isNotInTsProject
|
||||
.map((file) => ` - ${file.repoRel}`)
|
||||
.join('\n')}`
|
||||
);
|
||||
|
|
|
@ -22,24 +22,24 @@ function getPluginSearchPaths({ rootDir, oss, examples, testPlugins }) {
|
|||
resolve(rootDir, '..', 'kibana-extra'),
|
||||
...(testPlugins
|
||||
? [
|
||||
resolve(rootDir, 'test/analytics/fixtures/plugins'),
|
||||
resolve(rootDir, 'test/analytics/plugins'),
|
||||
resolve(rootDir, 'test/health_gateway/plugins'),
|
||||
resolve(rootDir, 'test/plugin_functional/plugins'),
|
||||
resolve(rootDir, 'test/interpreter_functional/plugins'),
|
||||
resolve(rootDir, 'test/common/fixtures/plugins'),
|
||||
resolve(rootDir, 'test/server_integration/__fixtures__/plugins'),
|
||||
resolve(rootDir, 'test/common/plugins'),
|
||||
resolve(rootDir, 'test/server_integration/plugins'),
|
||||
]
|
||||
: []),
|
||||
...(testPlugins && !oss
|
||||
? [
|
||||
resolve(rootDir, 'x-pack/test/plugin_functional/plugins'),
|
||||
resolve(rootDir, 'x-pack/test/functional_with_es_ssl/fixtures/plugins'),
|
||||
resolve(rootDir, 'x-pack/test/functional_with_es_ssl/plugins'),
|
||||
resolve(rootDir, 'x-pack/test/alerting_api_integration/plugins'),
|
||||
resolve(rootDir, 'x-pack/test/plugin_api_integration/plugins'),
|
||||
resolve(rootDir, 'x-pack/test/plugin_api_perf/plugins'),
|
||||
resolve(rootDir, 'x-pack/test/licensing_plugin/plugins'),
|
||||
resolve(rootDir, 'x-pack/test/usage_collection/plugins'),
|
||||
resolve(rootDir, 'x-pack/test/security_functional/fixtures/common'),
|
||||
resolve(rootDir, 'x-pack/test/security_functional/plugins'),
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import { REPO_ROOT } from '@kbn/repo-info';
|
||||
import { parseTelemetryRC } from './config';
|
||||
|
||||
describe('parseTelemetryRC', () => {
|
||||
|
@ -16,7 +17,7 @@ describe('parseTelemetryRC', () => {
|
|||
});
|
||||
|
||||
it('returns parsed rc file', async () => {
|
||||
const configRoot = path.join(process.cwd(), 'src', 'fixtures', 'telemetry_collectors');
|
||||
const configRoot = path.resolve(REPO_ROOT, 'src/fixtures/telemetry_collectors');
|
||||
const config = await parseTelemetryRC(configRoot);
|
||||
expect(config).toStrictEqual([
|
||||
{
|
||||
|
|
|
@ -8,13 +8,14 @@
|
|||
|
||||
import * as ts from 'typescript';
|
||||
import * as path from 'path';
|
||||
import { REPO_ROOT } from '@kbn/repo-info';
|
||||
import { extractCollectors, getProgramPaths } from './extract_collectors';
|
||||
import { parseTelemetryRC } from './config';
|
||||
import { allExtractedCollectors } from './__fixture__/all_extracted_collectors';
|
||||
|
||||
describe('extractCollectors', () => {
|
||||
it('extracts collectors given rc file', async () => {
|
||||
const configRoot = path.join(process.cwd(), 'src', 'fixtures', 'telemetry_collectors');
|
||||
const configRoot = path.join(REPO_ROOT, 'src/fixtures/telemetry_collectors');
|
||||
const tsConfig = ts.findConfigFile('./', ts.sys.fileExists, 'tsconfig.json');
|
||||
if (!tsConfig) {
|
||||
throw new Error('Could not find a valid tsconfig.json.');
|
||||
|
|
|
@ -8,17 +8,15 @@
|
|||
|
||||
import * as ts from 'typescript';
|
||||
import * as path from 'path';
|
||||
import { REPO_ROOT } from '@kbn/repo-info';
|
||||
import { getDescriptor, TelemetryKinds } from './serializer';
|
||||
import { traverseNodes } from './ts_parser';
|
||||
import { compilerHost } from './compiler_host';
|
||||
|
||||
export function loadFixtureProgram(fixtureName: string) {
|
||||
const fixturePath = path.resolve(
|
||||
process.cwd(),
|
||||
'src',
|
||||
'fixtures',
|
||||
'telemetry_collectors',
|
||||
`${fixtureName}.ts`
|
||||
REPO_ROOT,
|
||||
`src/fixtures/telemetry_collectors/${fixtureName}.ts`
|
||||
);
|
||||
const tsConfig = ts.findConfigFile('./', ts.sys.fileExists, 'tsconfig.json');
|
||||
if (!tsConfig) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import { parseUsageCollection } from './ts_parser';
|
||||
import * as ts from 'typescript';
|
||||
import * as path from 'path';
|
||||
import { REPO_ROOT } from '@kbn/repo-info';
|
||||
import { compilerHost } from './compiler_host';
|
||||
import { parsedWorkingCollector } from './__fixture__/parsed_working_collector';
|
||||
import { parsedNestedCollector } from './__fixture__/parsed_nested_collector';
|
||||
|
@ -20,13 +21,7 @@ import { parsedStatsCollector } from './__fixture__/parsed_stats_collector';
|
|||
import { parsedImportedInterfaceFromExport } from './__fixture__/parsed_imported_interface_from_export';
|
||||
|
||||
export function loadFixtureProgram(fixtureName: string) {
|
||||
const fixturePath = path.resolve(
|
||||
process.cwd(),
|
||||
'src',
|
||||
'fixtures',
|
||||
'telemetry_collectors',
|
||||
`${fixtureName}`
|
||||
);
|
||||
const fixturePath = path.resolve(REPO_ROOT, `src/fixtures/telemetry_collectors/${fixtureName}`);
|
||||
const tsConfig = ts.findConfigFile('./', ts.sys.fileExists, 'tsconfig.json');
|
||||
if (!tsConfig) {
|
||||
throw new Error('Could not find a valid tsconfig.json.');
|
||||
|
|
|
@ -20,4 +20,4 @@ expect(events).to...
|
|||
|
||||
If you are reusing these helpers in another suite, please remember to make sure to optIn via `await getService('kibana_ebt_ui').setOptIn(true);`
|
||||
|
||||
Refer to [`EBTHelpersContract`](./fixtures/plugins/analytics_ftr_helpers/common/types.ts#:~:text=EBTHelpersContract) for more details about the existing APIs and all the options they accept.
|
||||
Refer to [`EBTHelpersContract`](./plugins/analytics_ftr_helpers/common/types.ts#:~:text=EBTHelpersContract) for more details about the existing APIs and all the options they accept.
|
|
@ -35,8 +35,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
serverArgs: [
|
||||
...functionalConfig.get('kbnTestServer.serverArgs'),
|
||||
'--telemetry.optIn=true',
|
||||
`--plugin-path=${path.resolve(__dirname, './fixtures/plugins/analytics_plugin_a')}`,
|
||||
`--plugin-path=${path.resolve(__dirname, './fixtures/plugins/analytics_ftr_helpers')}`,
|
||||
`--plugin-path=${path.resolve(__dirname, './plugins/analytics_plugin_a')}`,
|
||||
`--plugin-path=${path.resolve(__dirname, './plugins/analytics_ftr_helpers')}`,
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
module.exports = {
|
||||
preset: '@kbn/test',
|
||||
rootDir: '../../../../..',
|
||||
roots: ['<rootDir>/test/analytics/fixtures/plugins/analytics_ftr_helpers'],
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/test/analytics/plugins/analytics_ftr_helpers'],
|
||||
coverageDirectory:
|
||||
'<rootDir>/target/kibana-coverage/jest/test/analytics/fixtures/plugins/analytics_ftr_helpers',
|
||||
'<rootDir>/target/kibana-coverage/jest/test/analytics/plugins/analytics_ftr_helpers',
|
||||
coverageReporters: ['text', 'html'],
|
||||
collectCoverageFrom: [
|
||||
'<rootDir>/test/analytics/fixtures/plugins/analytics_ftr_helpers/{common,public,server}/**/*.{ts,tsx}',
|
||||
'<rootDir>/test/analytics/plugins/analytics_ftr_helpers/{common,public,server}/**/*.{ts,tsx}',
|
||||
],
|
||||
};
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"name": "analytics_ftr_helpers",
|
||||
"version": "1.0.0",
|
||||
"main": "target/test/analytics/fixtures/plugins/analytics_ftr_helpers",
|
||||
"kibana": {
|
||||
"version": "kibana",
|
||||
"templateVersion": "1.0.0"
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"extends": "../../../../../tsconfig.base.json",
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types",
|
||||
},
|
||||
|
@ -8,7 +8,7 @@
|
|||
"common/**/*.ts",
|
||||
"public/**/*.ts",
|
||||
"server/**/*.ts",
|
||||
"../../../../../typings/**/*",
|
||||
"../../../../typings/**/*",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"name": "analytics_plugin_a",
|
||||
"version": "1.0.0",
|
||||
"main": "target/test/analytics/fixtures/plugins/analytics_plugin_a",
|
||||
"kibana": {
|
||||
"version": "kibana",
|
||||
"templateVersion": "1.0.0"
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"extends": "../../../../../tsconfig.base.json",
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types",
|
||||
},
|
||||
|
@ -7,7 +7,7 @@
|
|||
"index.ts",
|
||||
"public/**/*.ts",
|
||||
"server/**/*.ts",
|
||||
"../../../../../typings/**/*",
|
||||
"../../../../typings/**/*",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
|
@ -50,9 +50,9 @@ export default function () {
|
|||
'--telemetry.sendUsageTo=staging',
|
||||
`--server.maxPayload=1679958`,
|
||||
// newsfeed mock service
|
||||
`--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'newsfeed')}`,
|
||||
`--plugin-path=${path.join(__dirname, 'plugins', 'newsfeed')}`,
|
||||
// otel mock service
|
||||
`--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'otel_metrics')}`,
|
||||
`--plugin-path=${path.join(__dirname, 'plugins', 'otel_metrics')}`,
|
||||
`--newsfeed.service.urlRoot=${servers.kibana.protocol}://${servers.kibana.hostname}:${servers.kibana.port}`,
|
||||
`--newsfeed.service.pathTemplate=/api/_newsfeed-FTS-external-service-simulators/kibana/v{VERSION}.json`,
|
||||
`--logging.appenders.deprecation=${JSON.stringify({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "newsfeedFixtures",
|
||||
"id": "newsfeedTestPlugin",
|
||||
"owner": {
|
||||
"name": "Core",
|
||||
"githubTeam": "kibana-core"
|
|
@ -45,7 +45,7 @@ export class NewsFeedSimulatorPlugin implements Plugin {
|
|||
items: [
|
||||
{
|
||||
title: { en: `You are functionally testing the newsfeed widget with fixtures!` },
|
||||
description: { en: 'See test/common/fixtures/plugins/newsfeed/newsfeed_simulation' },
|
||||
description: { en: 'See test/common/plugins/newsfeed/newsfeed_simulation' },
|
||||
link_text: { en: 'Generic feed-viewer could go here' },
|
||||
link_url: { en: 'https://feeds.elastic.co' },
|
||||
languages: null,
|
16
test/common/plugins/newsfeed/tsconfig.json
Normal file
16
test/common/plugins/newsfeed/tsconfig.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types"
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
],
|
||||
"kbn_references": [
|
||||
"@kbn/core",
|
||||
]
|
||||
}
|
16
test/common/plugins/otel_metrics/tsconfig.json
Normal file
16
test/common/plugins/otel_metrics/tsconfig.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types"
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
],
|
||||
"kbn_references": [
|
||||
"@kbn/core",
|
||||
]
|
||||
}
|
|
@ -17,7 +17,7 @@ import { services } from './services';
|
|||
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
||||
const xPackAPITestsConfig = await readConfigFile(require.resolve('../api_integration/config'));
|
||||
|
||||
const testEndpointsPlugin = resolve(__dirname, './fixtures/test_endpoints');
|
||||
const testEndpointsPlugin = resolve(__dirname, './plugins/test_endpoints');
|
||||
|
||||
const tempKibanaYamlFile = join(getDataPath(), `interactive_setup_kibana_${Date.now()}.yml`);
|
||||
await fs.writeFile(tempKibanaYamlFile, '');
|
||||
|
|
|
@ -17,7 +17,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
|
||||
const testEndpointsPlugin = resolve(
|
||||
__dirname,
|
||||
'../interactive_setup_api_integration/fixtures/test_endpoints'
|
||||
'../interactive_setup_api_integration/plugins/test_endpoints'
|
||||
);
|
||||
|
||||
const tempKibanaYamlFile = join(getDataPath(), `interactive_setup_kibana_${Date.now()}.yml`);
|
||||
|
|
|
@ -7,12 +7,12 @@ node scripts/build_kibana_platform_plugins \
|
|||
--scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \
|
||||
--scan-dir "$KIBANA_DIR/test/health_gateway/plugins" \
|
||||
--scan-dir "$KIBANA_DIR/test/interpreter_functional/plugins" \
|
||||
--scan-dir "$KIBANA_DIR/test/common/fixtures/plugins" \
|
||||
--scan-dir "$KIBANA_DIR/test/common/plugins" \
|
||||
--scan-dir "$KIBANA_DIR/examples" \
|
||||
--scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \
|
||||
--scan-dir "$KIBANA_DIR/test/common/fixtures/plugins" \
|
||||
--scan-dir "$KIBANA_DIR/test/common/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/plugin_functional/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/functional_with_es_ssl/fixtures/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/functional_with_es_ssl/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/alerting_api_integration/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/plugin_api_integration/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/plugin_api_perf/plugins" \
|
||||
|
|
|
@ -5,9 +5,9 @@ source src/dev/ci_setup/setup_env.sh
|
|||
echo " -> building kibana platform plugins"
|
||||
node scripts/build_kibana_platform_plugins \
|
||||
--scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \
|
||||
--scan-dir "$KIBANA_DIR/test/common/fixtures/plugins" \
|
||||
--scan-dir "$KIBANA_DIR/test/common/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/plugin_functional/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/functional_with_es_ssl/fixtures/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/functional_with_es_ssl/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/alerting_api_integration/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/plugin_api_integration/plugins" \
|
||||
--scan-dir "$XPACK_DIR/test/plugin_api_perf/plugins" \
|
||||
|
|
|
@ -22,11 +22,9 @@ import { FtrConfigProviderContext } from '@kbn/test';
|
|||
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
||||
const httpConfig = await readConfigFile(require.resolve('../../config.base.js'));
|
||||
|
||||
// Find all folders in __fixtures__/plugins since we treat all them as plugin folder
|
||||
const allFiles = fs.readdirSync(path.resolve(__dirname, '../../__fixtures__/plugins'));
|
||||
const plugins = allFiles.filter((file) =>
|
||||
fs.statSync(path.resolve(__dirname, '../../__fixtures__/plugins', file)).isDirectory()
|
||||
);
|
||||
// Find all folders in plugins since we treat all them as plugin folder
|
||||
const pluginDir = path.resolve(__dirname, '../../plugins');
|
||||
const pluginsDirs = fs.readdirSync(pluginDir).map((name) => path.resolve(pluginDir, name));
|
||||
|
||||
return {
|
||||
testFiles: [
|
||||
|
@ -43,10 +41,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
...httpConfig.get('kbnTestServer'),
|
||||
serverArgs: [
|
||||
...httpConfig.get('kbnTestServer.serverArgs'),
|
||||
...plugins.map(
|
||||
(pluginDir) =>
|
||||
`--plugin-path=${path.resolve(__dirname, '../../__fixtures__/plugins', pluginDir)}`
|
||||
),
|
||||
...pluginsDirs.map((p) => `--plugin-path=${p}`),
|
||||
],
|
||||
runOptions: {
|
||||
...httpConfig.get('kbnTestServer.runOptions'),
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"name": "status_plugin_a",
|
||||
"version": "1.0.0",
|
||||
"main": "target/test/server_integration/__fixtures__/plugins/status_plugin_a",
|
||||
"kibana": {
|
||||
"version": "kibana",
|
||||
"templateVersion": "1.0.0"
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"extends": "../../../../../tsconfig.base.json",
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types",
|
||||
},
|
||||
"include": [
|
||||
"index.ts",
|
||||
"server/**/*.ts",
|
||||
"../../../../../../typings/**/*",
|
||||
"../../../../typings/**/*",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"name": "status_plugin_b",
|
||||
"version": "1.0.0",
|
||||
"main": "target/test/server_integration/__fixtures__/plugins/status_plugin_b",
|
||||
"kibana": {
|
||||
"version": "kibana",
|
||||
"templateVersion": "1.0.0"
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"extends": "../../../../../tsconfig.base.json",
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types"
|
||||
},
|
||||
"include": [
|
||||
"index.ts",
|
||||
"server/**/*.ts",
|
||||
"../../../../../typings/**/*",
|
||||
"../../../../typings/**/*",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
|
@ -20,9 +20,6 @@
|
|||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
"analytics/fixtures/plugins/**/*",
|
||||
"interactive_setup_api_integration/fixtures/test_endpoints/**/*",
|
||||
"server_integration/__fixtures__/plugins/**/*",
|
||||
"*/plugins/**/*",
|
||||
],
|
||||
"kbn_references": [
|
||||
|
@ -37,7 +34,6 @@
|
|||
"@kbn/visualizations-plugin",
|
||||
"@kbn/analytics-ftr-helpers-plugin",
|
||||
"@kbn/analytics-plugin-a-plugin",
|
||||
{ "path": "interactive_setup_api_integration/fixtures/test_endpoints/tsconfig.json" },
|
||||
"@kbn/core-app-status-plugin",
|
||||
"@kbn/core-provider-plugin",
|
||||
"@kbn/test",
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
"@kbn/aiops-utils/*": ["x-pack/packages/ml/aiops_utils/*"],
|
||||
"@kbn/alerting-example-plugin": ["x-pack/examples/alerting_example"],
|
||||
"@kbn/alerting-example-plugin/*": ["x-pack/examples/alerting_example/*"],
|
||||
"@kbn/alerting-fixture-plugin": ["x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts"],
|
||||
"@kbn/alerting-fixture-plugin/*": ["x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/*"],
|
||||
"@kbn/alerting-fixture-plugin": ["x-pack/test/functional_with_es_ssl/plugins/alerts"],
|
||||
"@kbn/alerting-fixture-plugin/*": ["x-pack/test/functional_with_es_ssl/plugins/alerts/*"],
|
||||
"@kbn/alerting-plugin": ["x-pack/plugins/alerting"],
|
||||
"@kbn/alerting-plugin/*": ["x-pack/plugins/alerting/*"],
|
||||
"@kbn/alerts": ["packages/kbn-alerts"],
|
||||
|
@ -36,10 +36,10 @@
|
|||
"@kbn/analytics/*": ["packages/kbn-analytics/*"],
|
||||
"@kbn/analytics-client": ["packages/analytics/client"],
|
||||
"@kbn/analytics-client/*": ["packages/analytics/client/*"],
|
||||
"@kbn/analytics-ftr-helpers-plugin": ["test/analytics/fixtures/plugins/analytics_ftr_helpers"],
|
||||
"@kbn/analytics-ftr-helpers-plugin/*": ["test/analytics/fixtures/plugins/analytics_ftr_helpers/*"],
|
||||
"@kbn/analytics-plugin-a-plugin": ["test/analytics/fixtures/plugins/analytics_plugin_a"],
|
||||
"@kbn/analytics-plugin-a-plugin/*": ["test/analytics/fixtures/plugins/analytics_plugin_a/*"],
|
||||
"@kbn/analytics-ftr-helpers-plugin": ["test/analytics/plugins/analytics_ftr_helpers"],
|
||||
"@kbn/analytics-ftr-helpers-plugin/*": ["test/analytics/plugins/analytics_ftr_helpers/*"],
|
||||
"@kbn/analytics-plugin-a-plugin": ["test/analytics/plugins/analytics_plugin_a"],
|
||||
"@kbn/analytics-plugin-a-plugin/*": ["test/analytics/plugins/analytics_plugin_a/*"],
|
||||
"@kbn/analytics-shippers-elastic-v3-browser": ["packages/analytics/shippers/elastic_v3/browser"],
|
||||
"@kbn/analytics-shippers-elastic-v3-browser/*": ["packages/analytics/shippers/elastic_v3/browser/*"],
|
||||
"@kbn/analytics-shippers-elastic-v3-common": ["packages/analytics/shippers/elastic_v3/common"],
|
||||
|
@ -86,8 +86,8 @@
|
|||
"@kbn/canvas-plugin/*": ["x-pack/plugins/canvas/*"],
|
||||
"@kbn/cases-components": ["packages/kbn-cases-components"],
|
||||
"@kbn/cases-components/*": ["packages/kbn-cases-components/*"],
|
||||
"@kbn/cases-fixture-plugin": ["x-pack/test/functional_with_es_ssl/fixtures/plugins/cases"],
|
||||
"@kbn/cases-fixture-plugin/*": ["x-pack/test/functional_with_es_ssl/fixtures/plugins/cases/*"],
|
||||
"@kbn/cases-fixture-plugin": ["x-pack/test/functional_with_es_ssl/plugins/cases"],
|
||||
"@kbn/cases-fixture-plugin/*": ["x-pack/test/functional_with_es_ssl/plugins/cases/*"],
|
||||
"@kbn/cases-plugin": ["x-pack/plugins/cases"],
|
||||
"@kbn/cases-plugin/*": ["x-pack/plugins/cases/*"],
|
||||
"@kbn/chart-expressions-common": ["src/plugins/chart_expressions/common"],
|
||||
|
@ -862,16 +862,16 @@
|
|||
"@kbn/monitoring-plugin/*": ["x-pack/plugins/monitoring/*"],
|
||||
"@kbn/navigation-plugin": ["src/plugins/navigation"],
|
||||
"@kbn/navigation-plugin/*": ["src/plugins/navigation/*"],
|
||||
"@kbn/newsfeed-fixtures-plugin": ["test/common/fixtures/plugins/newsfeed"],
|
||||
"@kbn/newsfeed-fixtures-plugin/*": ["test/common/fixtures/plugins/newsfeed/*"],
|
||||
"@kbn/newsfeed-plugin": ["src/plugins/newsfeed"],
|
||||
"@kbn/newsfeed-plugin/*": ["src/plugins/newsfeed/*"],
|
||||
"@kbn/newsfeed-test-plugin": ["test/common/plugins/newsfeed"],
|
||||
"@kbn/newsfeed-test-plugin/*": ["test/common/plugins/newsfeed/*"],
|
||||
"@kbn/notifications-plugin": ["x-pack/plugins/notifications"],
|
||||
"@kbn/notifications-plugin/*": ["x-pack/plugins/notifications/*"],
|
||||
"@kbn/observability-plugin": ["x-pack/plugins/observability"],
|
||||
"@kbn/observability-plugin/*": ["x-pack/plugins/observability/*"],
|
||||
"@kbn/open-telemetry-instrumented-plugin": ["test/common/fixtures/plugins/otel_metrics"],
|
||||
"@kbn/open-telemetry-instrumented-plugin/*": ["test/common/fixtures/plugins/otel_metrics/*"],
|
||||
"@kbn/open-telemetry-instrumented-plugin": ["test/common/plugins/otel_metrics"],
|
||||
"@kbn/open-telemetry-instrumented-plugin/*": ["test/common/plugins/otel_metrics/*"],
|
||||
"@kbn/optimizer": ["packages/kbn-optimizer"],
|
||||
"@kbn/optimizer/*": ["packages/kbn-optimizer/*"],
|
||||
"@kbn/optimizer-webpack-helpers": ["packages/kbn-optimizer-webpack-helpers"],
|
||||
|
@ -982,8 +982,8 @@
|
|||
"@kbn/security-plugin/*": ["x-pack/plugins/security/*"],
|
||||
"@kbn/security-solution-plugin": ["x-pack/plugins/security_solution"],
|
||||
"@kbn/security-solution-plugin/*": ["x-pack/plugins/security_solution/*"],
|
||||
"@kbn/security-test-endpoints-plugin": ["x-pack/test/security_functional/fixtures/common/test_endpoints"],
|
||||
"@kbn/security-test-endpoints-plugin/*": ["x-pack/test/security_functional/fixtures/common/test_endpoints/*"],
|
||||
"@kbn/security-test-endpoints-plugin": ["x-pack/test/security_functional/plugins/test_endpoints"],
|
||||
"@kbn/security-test-endpoints-plugin/*": ["x-pack/test/security_functional/plugins/test_endpoints/*"],
|
||||
"@kbn/securitysolution-autocomplete": ["packages/kbn-securitysolution-autocomplete"],
|
||||
"@kbn/securitysolution-autocomplete/*": ["packages/kbn-securitysolution-autocomplete/*"],
|
||||
"@kbn/securitysolution-es-utils": ["packages/kbn-securitysolution-es-utils"],
|
||||
|
@ -1148,10 +1148,10 @@
|
|||
"@kbn/stack-management-usage-test-plugin/*": ["x-pack/test/usage_collection/plugins/stack_management_usage_test/*"],
|
||||
"@kbn/state-containers-examples-plugin": ["examples/state_containers_examples"],
|
||||
"@kbn/state-containers-examples-plugin/*": ["examples/state_containers_examples/*"],
|
||||
"@kbn/status-plugin-a-plugin": ["test/server_integration/__fixtures__/plugins/status_plugin_a"],
|
||||
"@kbn/status-plugin-a-plugin/*": ["test/server_integration/__fixtures__/plugins/status_plugin_a/*"],
|
||||
"@kbn/status-plugin-b-plugin": ["test/server_integration/__fixtures__/plugins/status_plugin_b"],
|
||||
"@kbn/status-plugin-b-plugin/*": ["test/server_integration/__fixtures__/plugins/status_plugin_b/*"],
|
||||
"@kbn/status-plugin-a-plugin": ["test/server_integration/plugins/status_plugin_a"],
|
||||
"@kbn/status-plugin-a-plugin/*": ["test/server_integration/plugins/status_plugin_a/*"],
|
||||
"@kbn/status-plugin-b-plugin": ["test/server_integration/plugins/status_plugin_b"],
|
||||
"@kbn/status-plugin-b-plugin/*": ["test/server_integration/plugins/status_plugin_b/*"],
|
||||
"@kbn/std": ["packages/kbn-std"],
|
||||
"@kbn/std/*": ["packages/kbn-std/*"],
|
||||
"@kbn/stdio-dev-helpers": ["packages/kbn-stdio-dev-helpers"],
|
||||
|
|
|
@ -355,7 +355,7 @@ plugins.actions.registerSubActionConnectorType({
|
|||
});
|
||||
```
|
||||
|
||||
You can see a full example in [x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/sub_action_connector.ts](../../../../test/alerting_api_integration/common/fixtures/plugins/alerts/server/sub_action_connector.ts)
|
||||
You can see a full example in [x-pack/test/alerting_api_integration/common/plugins/alerts/server/sub_action_connector.ts](../../../../test/alerting_api_integration/common/plugins/alerts/server/sub_action_connector.ts)
|
||||
|
||||
### Example: Register sub action connector with custom validators
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ export const CASE_COMMENT_SAVED_OBJECT = 'cases-comments' as const;
|
|||
export const CASE_CONFIGURE_SAVED_OBJECT = 'cases-configure' as const;
|
||||
|
||||
/**
|
||||
* If more values are added here please also add them here: x-pack/test/cases_api_integration/common/fixtures/plugins
|
||||
* If more values are added here please also add them here: x-pack/test/cases_api_integration/common/plugins
|
||||
*/
|
||||
export const SAVED_OBJECT_TYPES = [
|
||||
CASE_SAVED_OBJECT,
|
||||
|
|
|
@ -384,7 +384,7 @@ We suggest following the template provided in `docs/action-type-template.asciido
|
|||
|
||||
## Tests
|
||||
|
||||
The connector type should have both unit tests and functional tests. For functional tests, if your connector interacts with a 3rd party service via HTTP, you may be able to create a simulator for your service to test with. See the existing functional test servers in the directory [`x-pack/test/alerting_api_integration/common/fixtures/plugins/actions_simulators/server`](../../test/alerting_api_integration/common/fixtures/plugins/actions_simulators/server)
|
||||
The connector type should have both unit tests and functional tests. For functional tests, if your connector interacts with a 3rd party service via HTTP, you may be able to create a simulator for your service to test with. See the existing functional test servers in the directory [`x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server`](../../test/alerting_api_integration/common/plugins/actions_simulators/server)
|
||||
|
||||
## Connector type config and secrets
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { FtrProviderContext } from '../../../../common/ftr_provider_context';
|
|||
import {
|
||||
ExternalServiceSimulator,
|
||||
getExternalServiceSimulatorPath,
|
||||
} from '../../../../common/fixtures/plugins/actions_simulators/server/plugin';
|
||||
} from '../../../../common/plugins/actions_simulators/server/plugin';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function casesWebhookTest({ getService }: FtrProviderContext) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { FtrProviderContext } from '../../../../common/ftr_provider_context';
|
|||
import {
|
||||
getExternalServiceSimulatorPath,
|
||||
ExternalServiceSimulator,
|
||||
} from '../../../../common/fixtures/plugins/actions_simulators/server/plugin';
|
||||
} from '../../../../common/plugins/actions_simulators/server/plugin';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function jiraTest({ getService }: FtrProviderContext) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { FtrProviderContext } from '../../../../common/ftr_provider_context';
|
|||
import {
|
||||
getExternalServiceSimulatorPath,
|
||||
ExternalServiceSimulator,
|
||||
} from '../../../../common/fixtures/plugins/actions_simulators/server/plugin';
|
||||
} from '../../../../common/plugins/actions_simulators/server/plugin';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function resilientTest({ getService }: FtrProviderContext) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { FtrProviderContext } from '../../../../common/ftr_provider_context';
|
|||
import {
|
||||
getExternalServiceSimulatorPath,
|
||||
ExternalServiceSimulator,
|
||||
} from '../../../../common/fixtures/plugins/actions_simulators/server/plugin';
|
||||
} from '../../../../common/plugins/actions_simulators/server/plugin';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function servicenowTest({ getService }: FtrProviderContext) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import http from 'http';
|
|||
import getPort from 'get-port';
|
||||
import { FtrProviderContext } from '../../../../common/ftr_provider_context';
|
||||
|
||||
import { getSlackServer } from '../../../../common/fixtures/plugins/actions_simulators/server/plugin';
|
||||
import { getSlackServer } from '../../../../common/plugins/actions_simulators/server/plugin';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function slackTest({ getService }: FtrProviderContext) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../../../common/ftr_provider_context';
|
|||
import {
|
||||
ExternalServiceSimulator,
|
||||
getExternalServiceSimulatorPath,
|
||||
} from '../../../../common/fixtures/plugins/actions_simulators/server/plugin';
|
||||
} from '../../../../common/plugins/actions_simulators/server/plugin';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function swimlaneTest({ getService }: FtrProviderContext) {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import http from 'http';
|
||||
import getPort from 'get-port';
|
||||
import { FtrProviderContext } from '../../../../common/ftr_provider_context';
|
||||
import { getWebhookServer } from '../../../../common/fixtures/plugins/actions_simulators/server/plugin';
|
||||
import { getWebhookServer } from '../../../../common/plugins/actions_simulators/server/plugin';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function webhookTest({ getService }: FtrProviderContext) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import fs from 'fs';
|
|||
import { CA_CERT_PATH } from '@kbn/dev-utils';
|
||||
import { FtrConfigProviderContext } from '@kbn/test';
|
||||
import { services } from './services';
|
||||
import { getAllExternalServiceSimulatorPaths } from './fixtures/plugins/actions_simulators/server/plugin';
|
||||
import { getAllExternalServiceSimulatorPaths } from './plugins/actions_simulators/server/plugin';
|
||||
import { getTlsWebhookServerUrls } from './lib/get_tls_webhook_servers';
|
||||
|
||||
interface CreateTestConfigOptions {
|
||||
|
@ -87,10 +87,11 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
|
|||
},
|
||||
};
|
||||
// Find all folders in ./plugins since we treat all them as plugin folder
|
||||
const allFiles = fs.readdirSync(path.resolve(__dirname, 'fixtures', 'plugins'));
|
||||
const plugins = allFiles.filter((file) =>
|
||||
fs.statSync(path.resolve(__dirname, 'fixtures', 'plugins', file)).isDirectory()
|
||||
);
|
||||
const pluginDir = path.resolve(__dirname, 'plugins');
|
||||
const pluginPaths = fs
|
||||
.readdirSync(pluginDir)
|
||||
.map((n) => path.resolve(pluginDir, n))
|
||||
.filter((p) => fs.statSync(p));
|
||||
|
||||
const proxyPort =
|
||||
process.env.ALERTING_PROXY_PORT ?? (await getPort({ port: getPort.makeRange(6200, 6299) }));
|
||||
|
@ -304,10 +305,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
|
|||
...disabledPlugins
|
||||
.filter((k) => k !== 'security')
|
||||
.map((key) => `--xpack.${key}.enabled=false`),
|
||||
...plugins.map(
|
||||
(pluginDir) =>
|
||||
`--plugin-path=${path.resolve(__dirname, 'fixtures', 'plugins', pluginDir)}`
|
||||
),
|
||||
...pluginPaths.map((p) => `--plugin-path=${p}`),
|
||||
`--server.xsrf.allowlist=${JSON.stringify(getAllExternalServiceSimulatorPaths())}`,
|
||||
...(ssl
|
||||
? [
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import getPort from 'get-port';
|
||||
import http from 'http';
|
||||
import httpProxy from 'http-proxy';
|
||||
import { getProxyPort } from '../../../../lib/get_proxy_server';
|
||||
import { getProxyPort } from '../../../lib/get_proxy_server';
|
||||
import { getDataFromRequest } from './data_handler';
|
||||
|
||||
export interface ProxyArgs {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue