mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
The plugin helper tests have failed due to timeouts every once and a while, which makes sense because they run a bunch of CLI tasks, so this just moved them to the jest integration tests where tests can take a little longer to run.
This commit is contained in:
parent
acd01a4881
commit
bd9e2148a5
17 changed files with 23 additions and 15 deletions
|
@ -23,11 +23,11 @@ const del = require('del');
|
||||||
|
|
||||||
const PLUGIN_FIXTURE = resolve(__dirname, '__fixtures__/build_action_test_plugin');
|
const PLUGIN_FIXTURE = resolve(__dirname, '__fixtures__/build_action_test_plugin');
|
||||||
const PLUGIN_BUILD_DIR = resolve(PLUGIN_FIXTURE, 'build');
|
const PLUGIN_BUILD_DIR = resolve(PLUGIN_FIXTURE, 'build');
|
||||||
const PLUGIN = require('../../lib/plugin_config')(PLUGIN_FIXTURE);
|
const PLUGIN = require('../../../lib/plugin_config')(PLUGIN_FIXTURE);
|
||||||
const noop = () => {};
|
const noop = () => {};
|
||||||
|
|
||||||
describe('creating build zip', () => {
|
describe('creating build zip', () => {
|
||||||
const buildAction = require('./build_action');
|
const buildAction = require('../build_action');
|
||||||
|
|
||||||
beforeEach(() => del(PLUGIN_BUILD_DIR));
|
beforeEach(() => del(PLUGIN_BUILD_DIR));
|
||||||
afterEach(() => del(PLUGIN_BUILD_DIR));
|
afterEach(() => del(PLUGIN_BUILD_DIR));
|
||||||
|
@ -58,8 +58,16 @@ describe('calling create_build', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
mockBuild = jest.fn(() => Promise.resolve());
|
mockBuild = jest.fn(() => Promise.resolve());
|
||||||
jest.mock('./create_build', () => mockBuild);
|
jest.mock('../create_build', () => mockBuild);
|
||||||
buildAction = require('./build_action');
|
buildAction = require('../build_action');
|
||||||
|
});
|
||||||
|
|
||||||
|
const nameArgs = ([plugin, buildTarget, buildVersion, kibanaVersion, files]) => ({
|
||||||
|
plugin,
|
||||||
|
buildTarget,
|
||||||
|
buildVersion,
|
||||||
|
kibanaVersion,
|
||||||
|
files,
|
||||||
});
|
});
|
||||||
|
|
||||||
it('takes optional build version', async () => {
|
it('takes optional build version', async () => {
|
||||||
|
@ -71,8 +79,8 @@ describe('calling create_build', () => {
|
||||||
await buildAction(PLUGIN, noop, options);
|
await buildAction(PLUGIN, noop, options);
|
||||||
|
|
||||||
expect(mockBuild.mock.calls).toHaveLength(1);
|
expect(mockBuild.mock.calls).toHaveLength(1);
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
const [ plugin, buildTarget, buildVersion, kibanaVersion, files ] = mockBuild.mock.calls[0];
|
const { buildVersion, kibanaVersion } = nameArgs(mockBuild.mock.calls[0]);
|
||||||
expect(buildVersion).toBe('1.2.3');
|
expect(buildVersion).toBe('1.2.3');
|
||||||
expect(kibanaVersion).toBe('4.5.6');
|
expect(kibanaVersion).toBe('4.5.6');
|
||||||
});
|
});
|
||||||
|
@ -81,8 +89,8 @@ describe('calling create_build', () => {
|
||||||
await buildAction(PLUGIN);
|
await buildAction(PLUGIN);
|
||||||
|
|
||||||
expect(mockBuild.mock.calls).toHaveLength(1);
|
expect(mockBuild.mock.calls).toHaveLength(1);
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
const [ plugin, buildTarget, buildVersion, kibanaVersion, files ] = mockBuild.mock.calls[0];
|
const { files } = nameArgs(mockBuild.mock.calls[0]);
|
||||||
PLUGIN.buildSourcePatterns.forEach(file => expect(files).toContain(file));
|
PLUGIN.buildSourcePatterns.forEach(file => expect(files).toContain(file));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -99,8 +107,8 @@ describe('calling create_build', () => {
|
||||||
await buildAction(PLUGIN, noop, options);
|
await buildAction(PLUGIN, noop, options);
|
||||||
|
|
||||||
expect(mockBuild.mock.calls).toHaveLength(1);
|
expect(mockBuild.mock.calls).toHaveLength(1);
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
const [ plugin, buildTarget, buildVersion, kibanaVersion, files ] = mockBuild.mock.calls[0];
|
const { files } = nameArgs(mockBuild.mock.calls[0]);
|
||||||
options.files.forEach(file => expect(files).toContain(file));
|
options.files.forEach(file => expect(files).toContain(file));
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
const { resolve } = require('path');
|
const { resolve } = require('path');
|
||||||
const { readdirSync, existsSync, unlink } = require('fs');
|
const { readdirSync, existsSync, unlink } = require('fs');
|
||||||
const del = require('del');
|
const del = require('del');
|
||||||
const createBuild = require('./create_build');
|
const createBuild = require('../create_build');
|
||||||
|
|
||||||
const PLUGIN_FIXTURE = resolve(__dirname, '__fixtures__/create_build_test_plugin');
|
const PLUGIN_FIXTURE = resolve(__dirname, '__fixtures__/create_build_test_plugin');
|
||||||
const PLUGIN = require('../../lib/plugin_config')(PLUGIN_FIXTURE);
|
const PLUGIN = require('../../../lib/plugin_config')(PLUGIN_FIXTURE);
|
||||||
const PLUGIN_BUILD_DIR = resolve(PLUGIN_FIXTURE, 'build');
|
const PLUGIN_BUILD_DIR = resolve(PLUGIN_FIXTURE, 'build');
|
||||||
const PLUGIN_BUILD_TARGET = resolve(PLUGIN_BUILD_DIR, 'kibana', PLUGIN.id);
|
const PLUGIN_BUILD_TARGET = resolve(PLUGIN_BUILD_DIR, 'kibana', PLUGIN.id);
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
const { resolve } = require('path');
|
const { resolve } = require('path');
|
||||||
const { statSync } = require('fs');
|
const { statSync } = require('fs');
|
||||||
const del = require('del');
|
const del = require('del');
|
||||||
const createBuild = require('./create_build');
|
const createBuild = require('../create_build');
|
||||||
const createPackage = require('./create_package');
|
const createPackage = require('../create_package');
|
||||||
|
|
||||||
const PLUGIN_FIXTURE = resolve(__dirname, '__fixtures__/create_package_test_plugin');
|
const PLUGIN_FIXTURE = resolve(__dirname, '__fixtures__/create_package_test_plugin');
|
||||||
const PLUGIN = require('../../lib/plugin_config')(PLUGIN_FIXTURE);
|
const PLUGIN = require('../../../lib/plugin_config')(PLUGIN_FIXTURE);
|
||||||
const PLUGIN_BUILD_DIR = resolve(PLUGIN_FIXTURE, 'build-custom');
|
const PLUGIN_BUILD_DIR = resolve(PLUGIN_FIXTURE, 'build-custom');
|
||||||
|
|
||||||
const buildVersion = PLUGIN.version;
|
const buildVersion = PLUGIN.version;
|
Loading…
Add table
Add a link
Reference in a new issue