Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Migrate test plugins ⇒ NP (kbn_tp_run_pipeline) (#64780) #65617

Merged
merged 2 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/dev/typescript/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export const PROJECTS = [
...glob
.sync('test/plugin_functional/plugins/*/tsconfig.json', { cwd: REPO_ROOT })
.map(path => new Project(resolve(REPO_ROOT, path))),
...glob
.sync('test/interpreter_functional/plugins/*/tsconfig.json', { cwd: REPO_ROOT })
.map(path => new Project(resolve(REPO_ROOT, path))),
];

export function filterProjectsByFlag(projectFlag?: string) {
Expand Down
3 changes: 3 additions & 0 deletions test/interpreter_functional/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) {
...functionalConfig.get('kbnTestServer'),
serverArgs: [
...functionalConfig.get('kbnTestServer.serverArgs'),

// Required to load new platform plugins via `--plugin-path` flag.
'--env.name=development',
...plugins.map(
pluginDir => `--plugin-path=${path.resolve(__dirname, 'plugins', pluginDir)}`
),
Expand Down
49 changes: 0 additions & 49 deletions test/interpreter_functional/plugins/kbn_tp_run_pipeline/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"id": "kbn_tp_run_pipeline",
"version": "0.0.1",
"kibanaVersion": "kibana",
"requiredPlugins": [
"data",
"savedObjects",
"kibanaUtils",
"expressions"
],
"server": false,
"ui": true
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "kbn_tp_run_pipeline",
"version": "1.0.0",
"main": "target/test/interpreter_functional/plugins/kbn_tp_run_pipeline",
"kibana": {
"version": "kibana",
"templateVersion": "1.0.0"
Expand All @@ -10,5 +11,13 @@
"@elastic/eui": "22.3.1",
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
"scripts": {
"kbn": "node ../../../../scripts/kbn.js",
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"@kbn/plugin-helpers": "9.0.2",
"typescript": "3.7.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import React from 'react';
import { EuiPage, EuiPageBody, EuiPageContent, EuiPageContentHeader } from '@elastic/eui';
import { first } from 'rxjs/operators';
import { IInterpreterRenderHandlers, ExpressionValue } from 'src/plugins/expressions';
import { RequestAdapter, DataAdapter } from '../../../../../../../../src/plugins/inspector';
import { RequestAdapter, DataAdapter } from '../../../../../../../src/plugins/inspector';
import { Adapters, ExpressionRenderHandler } from '../../types';
import { getExpressions } from '../../services';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@
* under the License.
*/

export * from './np_ready';
import { PluginInitializer, PluginInitializerContext } from 'src/core/public';
import { Plugin, StartDeps } from './plugin';
export { StartDeps };

export const plugin: PluginInitializer<void, void, {}, StartDeps> = (
initializerContext: PluginInitializerContext
) => {
return new Plugin(initializerContext);
};

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { createGetterSetter } from '../../../../../../src/plugins/kibana_utils/public';
import { createGetterSetter } from '../../../../../src/plugins/kibana_utils/public';
import { ExpressionsStart } from './types';

export const [getExpressions, setExpressions] = createGetterSetter<ExpressionsStart>('Expressions');
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "../../../../tsconfig.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
},
"include": [
"index.ts",
"public/**/*.ts",
"public/**/*.tsx",
"../../../../typings/**/*",
],
"exclude": []
}
9 changes: 5 additions & 4 deletions test/interpreter_functional/test_suites/run_pipeline/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ export default function({
await expectExpression('partial_test_2', metricExpr, context).toMatchSnapshot()
).toMatchScreenshot();

const regionMapExpr = `regionmap visConfig='{"metric":{"accessor":1,"format":{"id":"number"}},"bucket":{"accessor":0}}'`;
await (
await expectExpression('partial_test_3', regionMapExpr, context).toMatchSnapshot()
).toMatchScreenshot();
// TODO: should be uncommented when the region map is migrated to the new platform
// const regionMapExpr = `regionmap visConfig='{"metric":{"accessor":1,"format":{"id":"number"}},"bucket":{"accessor":0}}'`;
// await (
// await expectExpression('partial_test_3', regionMapExpr, context).toMatchSnapshot()
// ).toMatchScreenshot();
});
});
});
Expand Down
13 changes: 12 additions & 1 deletion test/interpreter_functional/test_suites/run_pipeline/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ import expect from '@kbn/expect';
import { ExpressionValue } from 'src/plugins/expressions';
import { FtrProviderContext } from '../../../functional/ftr_provider_context';

declare global {
interface Window {
runPipeline: (
expressions: string,
context?: ExpressionValue,
initialContext?: ExpressionValue
) => any;
renderPipelineResponse: (context?: ExpressionValue) => Promise<any>;
}
}

export type ExpressionResult = any;

export type ExpectExpression = (
Expand Down Expand Up @@ -165,7 +176,7 @@ export function expectExpressionProvider({
log.debug('starting to render');
const result = await browser.executeAsync<any>(
(_context: ExpressionResult, done: (renderResult: any) => void) =>
window.renderPipelineResponse(_context).then(renderResult => {
window.renderPipelineResponse(_context).then((renderResult: any) => {
done(renderResult);
return renderResult;
}),
Expand Down
1 change: 1 addition & 0 deletions test/scripts/jenkins_build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ echo " -> building kibana platform plugins"
node scripts/build_kibana_platform_plugins \
--oss \
--scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \
--scan-dir "$KIBANA_DIR/test/interpreter_functional/plugins" \
--verbose;

# doesn't persist, also set in kibanaPipeline.groovy
Expand Down
3 changes: 2 additions & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"typings/**/*"
],
"exclude": [
"plugin_functional/plugins/**/*"
"plugin_functional/plugins/**/*",
"interpreter_functional/plugins/**/*"
]
}