From d2bcbb74ceb5fffe8f1b9cf5e439803661df977b Mon Sep 17 00:00:00 2001 From: Spencer Date: Thu, 10 Oct 2019 16:32:38 -0700 Subject: [PATCH] [7.x] cleanup es even if test fails (#47868) (#47906) * cleanup es even if test fails * use correct beforeAll/afterAll hooks for jest --- .../integration_tests/generate_plugin.test.js | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js index c823bbc3be264..b43dcd80b4462 100644 --- a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js +++ b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js @@ -81,25 +81,29 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug await execa('yarn', ['build'], { cwd: generatedPath }); }); - it(`'yarn start' should result in the spec plugin being initialized on kibana's stdout`, async () => { + describe('with es instance', () => { const log = new ToolingLog(); + const es = createLegacyEsTestCluster({ license: 'basic', log }); - await es.start(); - await withProcRunner(log, async proc => { - await proc.run('kibana', { - cmd: 'yarn', - args: [ - 'start', - '--optimize.enabled=false', - '--logging.json=false', - '--migrations.skip=true', - ], - cwd: generatedPath, - wait: /ispec_plugin.+Status changed from uninitialized to green - Ready/, + beforeAll(es.start); + afterAll(es.stop); + + it(`'yarn start' should result in the spec plugin being initialized on kibana's stdout`, async () => { + await withProcRunner(log, async proc => { + await proc.run('kibana', { + cmd: 'yarn', + args: [ + 'start', + '--optimize.enabled=false', + '--logging.json=false', + '--migrations.skip=true', + ], + cwd: generatedPath, + wait: /ispec_plugin.+Status changed from uninitialized to green - Ready/, + }); + await proc.stop('kibana'); }); - await proc.stop('kibana'); }); - await es.stop(); }); it(`'yarn preinstall' should exit 0`, async () => {