From a864993e6083647431a7cd832b128a9d80e2c9ff Mon Sep 17 00:00:00 2001 From: Lewis Sanchez <87730006+lewis-sanchez@users.noreply.github.com> Date: Fri, 4 Nov 2022 21:11:14 -0700 Subject: [PATCH] Extension unit tests should continue on error (#21099) * Extension unit tests continue on error * Fix script syntax issue. * Block syntax issue * Remove condition expression * Brings back condition for sql product build linux yml * Comment out condition in ci.yml * Adds continue on error clause to ci.yml extension unit tests * Adds condition to extension unit tests step in ci.yml * Adds run extension unit test case for fail on error * Adds fail on error case to Run Extension Unit Tests script * Explicitly states continue on error false. * Format adjustment to yml file * Changes default state to fail on error * Update .github/workflows/ci.yml Co-authored-by: Charles Gagnon * Update build/azure-pipelines/linux/sql-product-build-linux.yml Co-authored-by: Charles Gagnon * Update build/azure-pipelines/linux/sql-product-build-linux.yml Co-authored-by: Charles Gagnon * Brings back original comment. Co-authored-by: Charles Gagnon --- .github/workflows/ci.yml | 11 +++++++++-- .../linux/sql-product-build-linux.yml | 19 +++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19bee2223d..d0879e7925 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,9 +142,16 @@ jobs: id: electron-unit-tests run: DISPLAY=:10 ./scripts/test.sh --runGlob "**/sql/**/*.test.js" --coverage - - name: Run Extension Unit Tests # {{SQL CARBON EDIT}} Rename to core for clarity - id: electron-extension-unit-tests + - name: Run Extension Unit Tests (Continue on Error) # {{SQL CARBON EDIT}} Run extension unit tests (continue on error) + id: electron-extension-unit-tests-continue-on-error run: DISPLAY=:10 ./scripts/test-extensions-unit.sh + continueOnError: true + condition: and(succeeded(), eq(variables['EXTENSION_UNIT_TESTS_FAIL_ON_ERROR'], 'false')) + + - name: Run Extension Unit Tests (Fail on Error) # {{SQL CARBON EDIT}} Run extension unit tests (fail on error) + id: electron-extension-unit-tests-fail-on-error + run: DISPLAY=:10 ./scripts/test-extensions-unit.sh + condition: and(succeeded(), ne(variables['EXTENSION_UNIT_TESTS_FAIL_ON_ERROR'], 'false')) # {{SQL CARBON EDIT}} Add coveralls. We merge first to get around issue where parallel builds weren't being combined correctly - name: Combine code coverage files diff --git a/build/azure-pipelines/linux/sql-product-build-linux.yml b/build/azure-pipelines/linux/sql-product-build-linux.yml index 877305b94c..5f29358cc5 100644 --- a/build/azure-pipelines/linux/sql-product-build-linux.yml +++ b/build/azure-pipelines/linux/sql-product-build-linux.yml @@ -147,8 +147,23 @@ steps: NO_CLEANUP=1 \ VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-linux-x64" \ DISPLAY=:10 ./scripts/test-extensions-unit.sh --build --tfs "Extension Unit Tests" - displayName: 'Run Extension Unit Tests' - condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true')) + displayName: Run Extension Unit Tests (Continue on Error) + continueOnError: true + condition: and(succeeded(), and(eq(variables['RUN_TESTS'], 'true'), eq(variables['EXTENSION_UNIT_TESTS_FAIL_ON_ERROR'], 'false'))) + + - script: | + # Figure out the full absolute path of the product we just built + # including the remote server and configure the unit tests + # to run with these builds instead of running out of sources. + set -e + APP_ROOT=$(agent.builddirectory)/azuredatastudio-linux-x64 + APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName") + INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \ + NO_CLEANUP=1 \ + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-linux-x64" \ + DISPLAY=:10 ./scripts/test-extensions-unit.sh --build --tfs "Extension Unit Tests" + displayName: Run Extension Unit Tests (Fail on Error) + condition: and(succeeded(), and(eq(variables['RUN_TESTS'], 'true'), ne(variables['EXTENSION_UNIT_TESTS_FAIL_ON_ERROR'], 'false'))) - bash: | set -e