CI: Run e2e tests in parallel using multiple suites (#41748)

* Split suite1 to multiple e2e test suites

* Update drone yaml

* Add missing arg

* Extract cypress install step

* Change image on e2e tests step

* Sync with main

* Add cypress cache volume

* Try with grafana/ci-e2e:12.19.0-1 image

* Update grabpl version to 2.7.2

* Revert a11y failure back to 'always'
This commit is contained in:
Dimitris Sotirakis 2021-11-24 11:20:11 +01:00 committed by GitHub
parent d624230b5d
commit db122e9b2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 711 additions and 97 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,11 +8,12 @@ PORT=${PORT:-$DEFAULT_PORT}
echo -e "Starting Cypress scenarios" echo -e "Starting Cypress scenarios"
args=("$@")
CMD="start" CMD="start"
PARAMS="" PARAMS=""
SLOWMO=0 SLOWMO=0
URL=${BASE_URL:-"http://$HOST:$PORT"} URL=${BASE_URL:-"http://$HOST:$PORT"}
SUITE=${SUITE:-$DEFAULT_SUITE}
if [ "$1" == "debug" ]; then if [ "$1" == "debug" ]; then
echo -e "Debug mode" echo -e "Debug mode"
@ -28,5 +29,5 @@ fi
cd packages/grafana-e2e cd packages/grafana-e2e
yarn $CMD --env BASE_URL=$URL,SLOWMO=$SLOWMO \ yarn $CMD --env BASE_URL=$URL,SLOWMO=$SLOWMO \
--config defaultCommandTimeout=30000,integrationFolder=../../e2e/$SUITE/specs,screenshotsFolder=../../e2e/$SUITE/screenshots,videosFolder=../../e2e/$SUITE/videos,fileServerFolder=./cypress,viewportWidth=1920,viewportHeight=1080,trashAssetsBeforeRuns=false,videoUploadOnPasses=false \ --config defaultCommandTimeout=30000,integrationFolder=../../e2e/"${args[0]}"/specs,screenshotsFolder=../../e2e"${args[0]}"/screenshots,videosFolder=../../e2e/"${args[0]}"/videos,fileServerFolder=./cypress,viewportWidth=1920,viewportHeight=1080,trashAssetsBeforeRuns=false,videoUploadOnPasses=false \
$PARAMS $PARAMS

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

View File

@ -8,4 +8,3 @@ DEFAULT_PACKAGE_FILE=dist/grafana-*linux-amd64.tar.gz
PROV_DIR=$RUNDIR/conf/provisioning PROV_DIR=$RUNDIR/conf/provisioning
DEFAULT_HOST=localhost DEFAULT_HOST=localhost
DEFAULT_PORT=3001 DEFAULT_PORT=3001
DEFAULT_SUITE=suite1

View File

@ -14,6 +14,7 @@ load(
'build_frontend_step', 'build_frontend_step',
'build_plugins_step', 'build_plugins_step',
'package_step', 'package_step',
'install_cypress_step',
'e2e_tests_server_step', 'e2e_tests_server_step',
'e2e_tests_step', 'e2e_tests_step',
'build_storybook_step', 'build_storybook_step',
@ -86,8 +87,12 @@ def get_steps(edition, is_downstream=False):
# Insert remaining steps # Insert remaining steps
steps.extend([ steps.extend([
package_step(edition=edition, ver_mode=ver_mode, include_enterprise2=include_enterprise2, is_downstream=is_downstream), package_step(edition=edition, ver_mode=ver_mode, include_enterprise2=include_enterprise2, is_downstream=is_downstream),
install_cypress_step(),
e2e_tests_server_step(edition=edition), e2e_tests_server_step(edition=edition),
e2e_tests_step(edition=edition), e2e_tests_step('dashboards-suite', edition=edition),
e2e_tests_step('smoke-tests-suite', edition=edition),
e2e_tests_step('panels-suite', edition=edition),
e2e_tests_step('various-suite', edition=edition),
build_storybook_step(edition=edition, ver_mode=ver_mode), build_storybook_step(edition=edition, ver_mode=ver_mode),
publish_storybook_step(edition=edition, ver_mode=ver_mode), publish_storybook_step(edition=edition, ver_mode=ver_mode),
test_a11y_frontend_step(ver_mode=ver_mode, edition=edition), test_a11y_frontend_step(ver_mode=ver_mode, edition=edition),
@ -113,6 +118,10 @@ def get_steps(edition, is_downstream=False):
package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64'], is_downstream=is_downstream), package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64'], is_downstream=is_downstream),
e2e_tests_server_step(edition=edition2, port=3002), e2e_tests_server_step(edition=edition2, port=3002),
e2e_tests_step(edition=edition2, port=3002), e2e_tests_step(edition=edition2, port=3002),
e2e_tests_step('dashboards-suite', edition=edition2, port=3002),
e2e_tests_step('smoke-tests-suite', edition=edition2, port=3002),
e2e_tests_step('panels-suite', edition=edition2, port=3002),
e2e_tests_step('various-suite', edition=edition2, port=3002),
upload_packages_step(edition=edition2, ver_mode=ver_mode, is_downstream=is_downstream), upload_packages_step(edition=edition2, ver_mode=ver_mode, is_downstream=is_downstream),
upload_cdn_step(edition=edition2) upload_cdn_step(edition=edition2)
]) ])

View File

@ -14,6 +14,7 @@ load(
'test_backend_integration_step', 'test_backend_integration_step',
'test_frontend_step', 'test_frontend_step',
'package_step', 'package_step',
'install_cypress_step',
'e2e_tests_server_step', 'e2e_tests_server_step',
'e2e_tests_step', 'e2e_tests_step',
'build_storybook_step', 'build_storybook_step',
@ -86,8 +87,12 @@ def pr_pipelines(edition):
# Insert remaining build_steps # Insert remaining build_steps
build_steps.extend([ build_steps.extend([
package_step(edition=edition, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=variants), package_step(edition=edition, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=variants),
install_cypress_step(),
e2e_tests_server_step(edition=edition), e2e_tests_server_step(edition=edition),
e2e_tests_step(edition=edition), e2e_tests_step('dashboards-suite', edition=edition),
e2e_tests_step('smoke-tests-suite', edition=edition),
e2e_tests_step('panels-suite', edition=edition),
e2e_tests_step('various-suite', edition=edition),
build_storybook_step(edition=edition, ver_mode=ver_mode), build_storybook_step(edition=edition, ver_mode=ver_mode),
test_a11y_frontend_step(ver_mode=ver_mode, edition=edition), test_a11y_frontend_step(ver_mode=ver_mode, edition=edition),
build_frontend_docs_step(edition=edition), build_frontend_docs_step(edition=edition),
@ -105,6 +110,10 @@ def pr_pipelines(edition):
package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64']), package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64']),
e2e_tests_server_step(edition=edition2, port=3002), e2e_tests_server_step(edition=edition2, port=3002),
e2e_tests_step(edition=edition2, port=3002), e2e_tests_step(edition=edition2, port=3002),
e2e_tests_step('dashboards-suite', edition=edition2, port=3002),
e2e_tests_step('smoke-tests-suite', edition=edition2, port=3002),
e2e_tests_step('panels-suite', edition=edition2, port=3002),
e2e_tests_step('various-suite', edition=edition2, port=3002),
]) ])
trigger = { trigger = {

View File

@ -17,6 +17,7 @@ load(
'build_frontend_step', 'build_frontend_step',
'build_plugins_step', 'build_plugins_step',
'package_step', 'package_step',
'install_cypress_step',
'e2e_tests_server_step', 'e2e_tests_server_step',
'e2e_tests_step', 'e2e_tests_step',
'build_storybook_step', 'build_storybook_step',
@ -114,8 +115,12 @@ def get_steps(edition, ver_mode):
# Insert remaining steps # Insert remaining steps
build_steps.extend([ build_steps.extend([
package_step(edition=edition, ver_mode=ver_mode, include_enterprise2=include_enterprise2), package_step(edition=edition, ver_mode=ver_mode, include_enterprise2=include_enterprise2),
install_cypress_step(),
e2e_tests_server_step(edition=edition), e2e_tests_server_step(edition=edition),
e2e_tests_step(edition=edition, tries=3), e2e_tests_step('dashboards-suite', edition=edition, tries=3),
e2e_tests_step('smoke-tests-suite', edition=edition, tries=3),
e2e_tests_step('panels-suite', edition=edition, tries=3),
e2e_tests_step('various-suite', edition=edition, tries=3),
copy_packages_for_docker_step(), copy_packages_for_docker_step(),
build_docker_images_step(edition=edition, ver_mode=ver_mode, publish=should_publish), build_docker_images_step(edition=edition, ver_mode=ver_mode, publish=should_publish),
build_docker_images_step(edition=edition, ver_mode=ver_mode, ubuntu=True, publish=should_publish), build_docker_images_step(edition=edition, ver_mode=ver_mode, ubuntu=True, publish=should_publish),
@ -145,7 +150,10 @@ def get_steps(edition, ver_mode):
publish_steps.extend([ publish_steps.extend([
package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64']), package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64']),
e2e_tests_server_step(edition=edition2, port=3002), e2e_tests_server_step(edition=edition2, port=3002),
e2e_tests_step(edition=edition2, port=3002, tries=3), e2e_tests_step('dashboards-suite', edition=edition2, port=3002, tries=3),
e2e_tests_step('smoke-tests-suite', edition=edition2, port=3002, tries=3),
e2e_tests_step('panels-suite', edition=edition2, port=3002, tries=3),
e2e_tests_step('various-suite', edition=edition2, port=3002, tries=3),
upload_cdn_step(edition=edition2), upload_cdn_step(edition=edition2),
]) ])
if should_upload: if should_upload:

View File

@ -1,6 +1,6 @@
load('scripts/drone/vault.star', 'from_secret', 'github_token', 'pull_secret', 'drone_token') load('scripts/drone/vault.star', 'from_secret', 'github_token', 'pull_secret', 'drone_token')
grabpl_version = '2.7.1' grabpl_version = '2.7.2'
build_image = 'grafana/build-container:1.4.6' build_image = 'grafana/build-container:1.4.6'
publish_image = 'grafana/grafana-ci-deploy:1.3.1' publish_image = 'grafana/grafana-ci-deploy:1.3.1'
grafana_docker_image = 'grafana/drone-grafana-docker:0.3.2' grafana_docker_image = 'grafana/drone-grafana-docker:0.3.2'
@ -276,7 +276,10 @@ def publish_storybook_step(edition, ver_mode):
'image': publish_image, 'image': publish_image,
'depends_on': [ 'depends_on': [
'build-storybook', 'build-storybook',
'end-to-end-tests', 'end-to-end-tests-dashboards-suite',
'end-to-end-tests-panels-suite',
'end-to-end-tests-smoke-tests-suite',
'end-to-end-tests-various-suite',
], ],
'environment': { 'environment': {
'GCP_KEY': from_secret('gcp_key'), 'GCP_KEY': from_secret('gcp_key'),
@ -650,24 +653,40 @@ def e2e_tests_server_step(edition, port=3001):
], ],
} }
def install_cypress_step():
return {
'name': 'cypress',
'image': 'grafana/ci-e2e:12.19.0-1',
'depends_on': [
'package',
],
'commands': [
'yarn run cypress install',
],
'volumes': [{
'name': 'cypress_cache',
'path': '/root/.cache/Cypress'
}],
}
def e2e_tests_step(edition, port=3001, tries=None): def e2e_tests_step(suite, edition, port=3001, tries=None):
cmd = './bin/grabpl e2e-tests --port {}'.format(port) cmd = './bin/grabpl e2e-tests --port {} --suite {}'.format(port, suite)
if tries: if tries:
cmd += ' --tries {}'.format(tries) cmd += ' --tries {}'.format(tries)
return { return {
'name': 'end-to-end-tests' + enterprise2_suffix(edition), 'name': 'end-to-end-tests-{}'.format(suite) + enterprise2_suffix(edition),
'image': 'grafana/ci-e2e:12.19.0-1', 'image': 'grafana/ci-e2e:12.19.0-1',
'depends_on': [ 'depends_on': [
'end-to-end-tests-server' + enterprise2_suffix(edition), 'cypress',
], ],
'environment': { 'environment': {
'HOST': 'end-to-end-tests-server' + enterprise2_suffix(edition), 'HOST': 'end-to-end-tests-server' + enterprise2_suffix(edition),
}, },
'volumes': [{
'name': 'cypress_cache',
'path': '/root/.cache/Cypress'
}],
'commands': [ 'commands': [
# Have to re-install Cypress since it insists on searching for its binary beneath /root/.cache,
# even though the Yarn cache directory is beneath /usr/local/share somewhere
'yarn run cypress install',
cmd, cmd,
], ],
} }
@ -832,7 +851,10 @@ def release_canary_npm_packages_step(edition):
'name': 'release-canary-npm-packages', 'name': 'release-canary-npm-packages',
'image': build_image, 'image': build_image,
'depends_on': [ 'depends_on': [
'end-to-end-tests', 'end-to-end-tests-dashboards-suite',
'end-to-end-tests-panels-suite',
'end-to-end-tests-smoke-tests-suite',
'end-to-end-tests-various-suite',
], ],
'environment': { 'environment': {
'GITHUB_PACKAGE_TOKEN': from_secret('github_package_token'), 'GITHUB_PACKAGE_TOKEN': from_secret('github_package_token'),
@ -862,7 +884,10 @@ def upload_packages_step(edition, ver_mode, is_downstream=False):
cmd = './bin/grabpl upload-packages --edition {}{}'.format(edition, packages_bucket) cmd = './bin/grabpl upload-packages --edition {}{}'.format(edition, packages_bucket)
dependencies = [ dependencies = [
'end-to-end-tests' + enterprise2_suffix(edition), 'end-to-end-tests-dashboards-suite' + enterprise2_suffix(edition),
'end-to-end-tests-panels-suite' + enterprise2_suffix(edition),
'end-to-end-tests-smoke-tests-suite' + enterprise2_suffix(edition),
'end-to-end-tests-various-suite' + enterprise2_suffix(edition),
] ]
if edition in ('enterprise', 'enterprise2'): if edition in ('enterprise', 'enterprise2'):

View File

@ -37,6 +37,10 @@ def pipeline(
'trigger': trigger, 'trigger': trigger,
'services': services, 'services': services,
'steps': steps, 'steps': steps,
'volumes': [{
'name': 'cypress_cache',
'temp': {},
}],
'depends_on': depends_on, 'depends_on': depends_on,
} }
pipeline.update(platform_conf) pipeline.update(platform_conf)