Skip to content

Commit

Permalink
Move status test to separate FTR config
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover committed Jun 21, 2021
1 parent e4625e5 commit 1e9a557
Show file tree
Hide file tree
Showing 18 changed files with 99 additions and 54 deletions.
1 change: 1 addition & 0 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63827,6 +63827,7 @@ function getProjectPaths({

projectPaths.push(Object(path__WEBPACK_IMPORTED_MODULE_0__["resolve"])(rootPath, 'test/plugin_functional/plugins/*'));
projectPaths.push(Object(path__WEBPACK_IMPORTED_MODULE_0__["resolve"])(rootPath, 'test/interpreter_functional/plugins/*'));
projectPaths.push(Object(path__WEBPACK_IMPORTED_MODULE_0__["resolve"])(rootPath, 'test/server_integration/__fixtures__/plugins/*'));
projectPaths.push(Object(path__WEBPACK_IMPORTED_MODULE_0__["resolve"])(rootPath, 'examples/*'));

if (!ossOnly) {
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-pm/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function getProjectPaths({ rootPath, ossOnly, skipKibanaPlugins }: Option
// correct and the expect behavior.
projectPaths.push(resolve(rootPath, 'test/plugin_functional/plugins/*'));
projectPaths.push(resolve(rootPath, 'test/interpreter_functional/plugins/*'));
projectPaths.push(resolve(rootPath, 'test/server_integration/__fixtures__/plugins/*'));
projectPaths.push(resolve(rootPath, 'examples/*'));

if (!ossOnly) {
Expand Down
3 changes: 3 additions & 0 deletions src/dev/typescript/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export const PROJECTS = [
...glob
.sync('test/interpreter_functional/plugins/*/tsconfig.json', { cwd: REPO_ROOT })
.map((path) => new Project(resolve(REPO_ROOT, path))),
...glob
.sync('test/server_integration/__fixtures__/plugins/*/tsconfig.json', { cwd: REPO_ROOT })
.map((path) => new Project(resolve(REPO_ROOT, path))),
];

export function filterProjectsByFlag(projectFlag?: string) {
Expand Down
7 changes: 7 additions & 0 deletions test/scripts/test/server_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ checks-reporter-with-killswitch "Server Integration Tests" \
--bail \
--debug \
--kibana-install-dir $KIBANA_INSTALL_DIR

# Tests that must be run against source in order to build test plugins
checks-reporter-with-killswitch "Status Integration Tests" \
node scripts/functional_tests \
--config test/server_integration/http/ssl/config.status.js \
--bail \
--debug \
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
CoreSetup,
ServiceStatus,
ServiceStatusLevels,
} from '../../../../../../../src/core/server';
} from '../../../../../../src/core/server';

export class CorePluginAPlugin implements Plugin {
private status$ = new Subject<ServiceStatus>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{
"extends": "../../../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
},
"include": [
"index.ts",
"public/**/*.ts",
"public/**/*.tsx",
"server/**/*.ts",
"../../../../../../typings/**/*",
],
"exclude": [],
"references": [
{ "path": "../../../../../../src/core/tsconfig.json" }
{ "path": "../../../../../src/core/tsconfig.json" }
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
* Side Public License, v 1.
*/

import { Plugin, CoreSetup } from 'kibana/server';
import { schema } from '@kbn/config-schema';
import { Plugin } from 'kibana/server';

export class CorePluginBPlugin implements Plugin {
public setup() {}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
},
"include": [
"index.ts",
"server/**/*.ts",
"../../../../../typings/**/*",
],
"exclude": [],
"references": [
{ "path": "../../../../../src/core/tsconfig.json" }
]
}
57 changes: 57 additions & 0 deletions test/server_integration/http/platform/config.status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 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 fs from 'fs';
import path from 'path';
import { FtrConfigProviderContext } from '@kbn/test';

/*
* These tests exist in a separate configuration because:
* 1) It must run as the first test after Kibana launches to clear the unavailable status. A separate config makes this
* easier to manage and prevent from breaking.
* 2) The other server_integration tests run against a built distributable, however the FTR does not support building
* and installing plugins against built Kibana. This test must be run against source only in order to build the
* fixture plugins
*/
// eslint-disable-next-line import/no-default-export
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const httpConfig = await readConfigFile(require.resolve('../../config'));

// 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, 'plugins', file)).isDirectory()
);

return {
testFiles: [
// Status test should be first to resolve manually created "unavailable" plugin
require.resolve('./status'),
],
services: httpConfig.get('services'),
servers: httpConfig.get('servers'),
junit: {
reportName: 'Kibana Platform Status Integration Tests',
},
esTestCluster: httpConfig.get('esTestCluster'),
kbnTestServer: {
...httpConfig.get('kbnTestServer'),
serverArgs: [
...httpConfig.get('kbnTestServer.serverArgs'),
...plugins.map(
(pluginDir) => `--plugin-path=${path.resolve(__dirname, 'plugins', pluginDir)}`
),
],
runOptions: {
...httpConfig.get('kbnTestServer.runOptions'),
// Don't wait for Kibana to be completely ready so that we can test the status timeouts
wait: /\[Kibana\]\[http\] http server running/,
},
},
};
}
30 changes: 2 additions & 28 deletions test/server_integration/http/platform/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,20 @@
* Side Public License, v 1.
*/

import fs from 'fs';
import path from 'path';
import { FtrConfigProviderContext } from '@kbn/test';

// eslint-disable-next-line import/no-default-export
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const httpConfig = await readConfigFile(require.resolve('../../config'));

// Find all folders in ./plugins since we treat all them as plugin folder
const allFiles = fs.readdirSync(path.resolve(__dirname, 'plugins'));
const plugins = allFiles.filter((file) =>
fs.statSync(path.resolve(__dirname, 'plugins', file)).isDirectory()
);

return {
testFiles: [
// Status test should be first to resolve manually created "unavailable" plugin
require.resolve('./status'),
require.resolve('./cache'),
require.resolve('./headers'),
],
testFiles: [require.resolve('./cache'), require.resolve('./headers')],
services: httpConfig.get('services'),
servers: httpConfig.get('servers'),
junit: {
reportName: 'Kibana Platform Http Integration Tests',
},
esTestCluster: httpConfig.get('esTestCluster'),
kbnTestServer: {
...httpConfig.get('kbnTestServer'),
serverArgs: [
...httpConfig.get('kbnTestServer.serverArgs'),
...plugins.map(
(pluginDir) => `--plugin-path=${path.resolve(__dirname, 'plugins', pluginDir)}`
),
],
runOptions: {
...httpConfig.get('kbnTestServer.runOptions'),
// Don't wait for Kibana to be completely ready so that we can test the status timeouts
wait: /\[Kibana\]\[http\] http server running/,
},
},
kbnTestServer: httpConfig.get('kbnTestServer'),
};
}

This file was deleted.

9 changes: 8 additions & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
"api_integration/apis/telemetry/fixtures/*.json",
"api_integration/apis/telemetry/fixtures/*.json",
],
"exclude": ["target/**/*", "plugin_functional/plugins/**/*", "interpreter_functional/plugins/**/*"],
"exclude": [
"target/**/*",
"interpreter_functional/plugins/**/*",
"plugin_functional/plugins/**/*",
"server_integration/__fixtures__/plugins/**/*",
],
"references": [
{ "path": "../src/core/tsconfig.json" },
{ "path": "../src/plugins/telemetry_management_section/tsconfig.json" },
Expand Down Expand Up @@ -52,5 +57,7 @@
{ "path": "../src/plugins/visualize/tsconfig.json" },
{ "path": "plugin_functional/plugins/core_app_status/tsconfig.json" },
{ "path": "plugin_functional/plugins/core_provider_plugin/tsconfig.json" },
{ "path": "server_integration/__fixtures__/plugins/core_plugin_a/tsconfig.json" },
{ "path": "server_integration/__fixtures__/plugins/core_plugin_b/tsconfig.json" },
]
}

0 comments on commit 1e9a557

Please sign in to comment.