From 999dca76c11e783aa80a0c1e0008172a294e1b63 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Sun, 29 Sep 2024 20:32:04 -0700 Subject: [PATCH] fix: cypress on master doesn't work because of --parallel flag (#30430) --- .github/workflows/bashlib.sh | 2 +- .github/workflows/superset-e2e.yml | 3 ++- scripts/cypress_run.py | 10 +++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bashlib.sh b/.github/workflows/bashlib.sh index c9029bdd2..0d359e059 100644 --- a/.github/workflows/bashlib.sh +++ b/.github/workflows/bashlib.sh @@ -165,7 +165,7 @@ cypress-run-all() { # UNCOMMENT the next few commands to monitor memory usage # monitor_memory & # Start memory monitoring in the background # memoryMonitorPid=$! - python ../../scripts/cypress_run.py --parallelism $PARALLELISM --parallelism-id $PARALLEL_ID --retries 5 $USE_DASHBOARD_FLAG + python ../../scripts/cypress_run.py --parallelism $PARALLELISM --parallelism-id $PARALLEL_ID --group $PARALLEL_ID --retries 5 $USE_DASHBOARD_FLAG # kill $memoryMonitorPid # After job is done, print out Flask log for debugging diff --git a/.github/workflows/superset-e2e.yml b/.github/workflows/superset-e2e.yml index 2f83f4725..134daebb2 100644 --- a/.github/workflows/superset-e2e.yml +++ b/.github/workflows/superset-e2e.yml @@ -48,7 +48,8 @@ jobs: PYTHONPATH: ${{ github.workspace }} REDIS_PORT: 16379 GITHUB_TOKEN: ${{ github.token }} - USE_DASHBOARD: ${{ github.event.inputs.use_dashboard || (github.ref == 'refs/heads/master' && 'true') || 'false' }} + # use the dashboard feature when running manually OR merging to master + USE_DASHBOARD: ${{ github.event.inputs.use_dashboard == 'true'|| (github.ref == 'refs/heads/master' && 'true') || 'false' }} services: postgres: image: postgres:15-alpine diff --git a/scripts/cypress_run.py b/scripts/cypress_run.py index cef760e81..738706d48 100644 --- a/scripts/cypress_run.py +++ b/scripts/cypress_run.py @@ -37,7 +37,7 @@ def generate_build_id() -> str: def run_cypress_for_test_file( - test_file: str, retries: int, use_dashboard: bool, group: str, dry_run: bool + test_file: str, retries: int, use_dashboard: bool, group: str, dry_run: bool, i: int ) -> int: """Runs Cypress for a single test file and retries upon failure.""" cypress_cmd = "./node_modules/.bin/cypress run" @@ -52,8 +52,8 @@ def run_cypress_for_test_file( cmd = ( f"{XVFB_PRE_CMD} " f'{cypress_cmd} --spec "{test_file}" --browser {browser} ' - f"--record --group {group} --tag {REPO},{GITHUB_EVENT_NAME} " - f"--parallel --ci-build-id {build_id} " + f"--record --group matrix{group}-file{i} --tag {REPO},{GITHUB_EVENT_NAME} " + f"--ci-build-id {build_id} " f"-- {chrome_flags}" ) else: @@ -159,9 +159,9 @@ def main() -> None: # Run each test file independently with retry logic or dry-run processed_file_count: int = 0 - for test_file in spec_list: + for i, test_file in enumerate(spec_list): result = run_cypress_for_test_file( - test_file, args.retries, args.use_dashboard, args.group, args.dry_run + test_file, args.retries, args.use_dashboard, args.group, args.dry_run, i ) if result != 0: print(f"Exiting due to failure in {test_file}")