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.16] Re-enable APM E2E tests and allow server to shut down cleanly on failure (#115450) #116201

Merged
merged 1 commit into from
Oct 25, 2021
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
12 changes: 6 additions & 6 deletions .buildkite/scripts/pipelines/pull_request/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ const uploadPipeline = (pipelineContent) => {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/security_solution.yml'));
}

// if (
// (await doAnyChangesMatch([/^x-pack\/plugins\/apm/])) ||
// process.env.GITHUB_PR_LABELS.includes('ci:all-cypress-suites')
// ) {
// pipeline.push(getPipeline('.buildkite/pipelines/pull_request/apm_cypress.yml'));
// }
if (
(await doAnyChangesMatch([/^x-pack\/plugins\/apm/])) ||
process.env.GITHUB_PR_LABELS.includes('ci:all-cypress-suites')
) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/apm_cypress.yml'));
}

if (await doAnyChangesMatch([/^x-pack\/plugins\/uptime/])) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/uptime.yml'));
Expand Down
8 changes: 6 additions & 2 deletions .buildkite/scripts/steps/functional/apm_cypress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

set -euo pipefail

source .buildkite/scripts/steps/functional/common.sh
source .buildkite/scripts/common/util.sh

.buildkite/scripts/bootstrap.sh
.buildkite/scripts/download_build_artifacts.sh

export JOB=kibana-apm-cypress

Expand All @@ -11,4 +14,5 @@ echo "--- APM Cypress Tests"
cd "$XPACK_DIR"

checks-reporter-with-killswitch "APM Cypress Tests" \
node plugins/apm/scripts/test/e2e.js
node plugins/apm/scripts/test/e2e.js \
--kibana-install-dir "$KIBANA_BUILD_LOCATION"
14 changes: 7 additions & 7 deletions vars/tasks.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ def functionalXpack(Map params = [:]) {
}
}

// whenChanged([
// 'x-pack/plugins/apm/',
// ]) {
// if (githubPr.isPr()) {
// task(kibanaPipeline.functionalTestProcess('xpack-APMCypress', './test/scripts/jenkins_apm_cypress.sh'))
// }
// }
whenChanged([
'x-pack/plugins/apm/',
]) {
if (githubPr.isPr()) {
task(kibanaPipeline.functionalTestProcess('xpack-APMCypress', './test/scripts/jenkins_apm_cypress.sh'))
}
}

whenChanged([
'x-pack/plugins/uptime/',
Expand Down
11 changes: 3 additions & 8 deletions x-pack/plugins/apm/ftr_e2e/cypress_start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@ import { esArchiverLoad, esArchiverUnload } from './cypress/tasks/es_archiver';

export function cypressRunTests(spec?: string) {
return async ({ getService }: FtrProviderContext) => {
try {
const result = await cypressStart(getService, cypress.run, spec);
const result = await cypressStart(getService, cypress.run, spec);

if (result && (result.status === 'failed' || result.totalFailed > 0)) {
process.exit(1);
}
} catch (error) {
console.error('errors: ', error);
process.exit(1);
if (result && (result.status === 'failed' || result.totalFailed > 0)) {
throw new Error(`APM Cypress tests failed`);
}
};
}
Expand Down
9 changes: 7 additions & 2 deletions x-pack/plugins/apm/scripts/test/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const yargs = require('yargs');
const childProcess = require('child_process');

const { argv } = yargs(process.argv.slice(2))
.option('kibana-install-dir', {
default: '',
type: 'string',
description: 'Path to the Kibana install directory',
})
.option('server', {
default: false,
type: 'boolean',
Expand All @@ -30,7 +35,7 @@ const { argv } = yargs(process.argv.slice(2))
})
.help();

const { server, runner, open } = argv;
const { server, runner, open, kibanaInstallDir } = argv;

const e2eDir = path.join(__dirname, '../../ftr_e2e');

Expand All @@ -44,6 +49,6 @@ if (server) {
const config = open ? './cypress_open.ts' : './cypress_run.ts';

childProcess.execSync(
`node ../../../../scripts/${ftrScript} --config ${config}`,
`node ../../../../scripts/${ftrScript} --config ${config} --kibana-install-dir '${kibanaInstallDir}'`,
{ cwd: e2eDir, stdio: 'inherit' }
);