You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by pi...@apache.org on 2023/03/06 21:47:19 UTC

[airflow] 35/37: Only skip provider integration tests for non-main builds (#29022)

This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun pushed a commit to branch v2-5-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 94bce2b76396da717de8fc7445dc2d5367e47b34
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sun Jan 22 10:47:08 2023 +0100

    Only skip provider integration tests for non-main builds (#29022)
    
    Previously we skipped all integration tests in non-main builds (i.e.
    builds that were running in v2-* branches where we test and prepare
    releases. This had two effects:
    
    * the non-provider integration tests were not run before release, which
      could have revealed some problems
    * constraint generation was skipped for those runs because constraint
      generation depended on integration tests
    
    This is now fixed:
    
    * integration tests are run on non-main builds
    * but all provider tests are skipped there
    
    (cherry picked from commit c04cfec6de68858d3372f16749244c34021310df)
---
 .github/workflows/ci.yml                               |  6 ++++--
 Dockerfile.ci                                          | 13 ++++++++++++-
 .../src/airflow_breeze/commands/testing_commands.py    |  9 +++++++++
 dev/breeze/src/airflow_breeze/params/shell_params.py   |  1 +
 images/breeze/output-commands-hash.txt                 |  4 ++--
 images/breeze/output_testing_integration-tests.svg     | 18 +++++++++++-------
 scripts/ci/docker-compose/_docker.env                  |  1 +
 scripts/ci/docker-compose/base.yml                     |  1 +
 scripts/docker/entrypoint_ci.sh                        | 13 ++++++++++++-
 9 files changed, 53 insertions(+), 13 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 86440754e3..e83e83af94 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1007,7 +1007,8 @@ jobs:
       BACKEND_VERSION: "${{needs.build-info.outputs.default-python-version}}"
       JOB_ID: "integration"
       COVERAGE: "${{needs.build-info.outputs.run-coverage}}"
-    if: needs.build-info.outputs.run-tests == 'true' && needs.build-info.outputs.default-branch == 'main'
+      SKIP_PROVIDER_TESTS: "${{needs.build-info.outputs.default-branch != 'main'}}"
+    if: needs.build-info.outputs.run-tests == 'true'
     steps:
       - name: Cleanup repo
         shell: bash
@@ -1066,7 +1067,8 @@ jobs:
       BACKEND_VERSION: "${{needs.build-info.outputs.default-python-version}}"
       JOB_ID: "integration"
       COVERAGE: "${{needs.build-info.outputs.run-coverage}}"
-    if: needs.build-info.outputs.run-tests == 'true' && needs.build-info.outputs.default-branch == 'main'
+      SKIP_PROVIDER_TESTS: "${{needs.build-info.outputs.default-branch != 'main'}}"
+    if: needs.build-info.outputs.run-tests == 'true'
     steps:
       - name: Cleanup repo
         shell: bash
diff --git a/Dockerfile.ci b/Dockerfile.ci
index f3d9bff8aa..6f12c1251b 100644
--- a/Dockerfile.ci
+++ b/Dockerfile.ci
@@ -926,6 +926,13 @@ else
         "${WWW_TESTS[@]}"
     )
 
+    NO_PROVIDERS_INTEGRATION_TESTS=(
+        "tests/integration/api"
+        "tests/integration/cli"
+        "tests/integration/executors"
+        "tests/integration/security"
+    )
+
     if [[ ${TEST_TYPE:=""} == "CLI" ]]; then
         SELECTED_TESTS=("${CLI_TESTS[@]}")
     elif [[ ${TEST_TYPE:=""} == "API" ]]; then
@@ -941,7 +948,11 @@ else
     elif [[ ${TEST_TYPE:=""} == "Helm" ]]; then
         SELECTED_TESTS=("${HELM_CHART_TESTS[@]}")
     elif [[ ${TEST_TYPE:=""} == "Integration" ]]; then
-        SELECTED_TESTS=("${INTEGRATION_TESTS[@]}")
+        if [[ ${SKIP_PROVIDER_TESTS:=""} == "true" ]]; then
+            SELECTED_TESTS=("${NO_PROVIDERS_INTEGRATION_TESTS[@]}")
+        else
+            SELECTED_TESTS=("${INTEGRATION_TESTS[@]}")
+        fi
     elif [[ ${TEST_TYPE:=""} == "Other" ]]; then
         find_all_other_tests
         SELECTED_TESTS=("${ALL_OTHER_TESTS[@]}")
diff --git a/dev/breeze/src/airflow_breeze/commands/testing_commands.py b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
index 1dcfa1196d..74c3069417 100644
--- a/dev/breeze/src/airflow_breeze/commands/testing_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
@@ -129,6 +129,7 @@ def _run_test(
         env_variables["DB_RESET"] = "true"
     perform_environment_checks()
     env_variables["TEST_TYPE"] = exec_shell_params.test_type
+    env_variables["SKIP_PROVIDER_TESTS"] = str(exec_shell_params.skip_provider_tests).lower()
     if "[" in exec_shell_params.test_type and not exec_shell_params.test_type.startswith("Providers"):
         get_console(output=output).print(
             "[error]Only 'Providers' test type can specify actual tests with \\[\\][/]"
@@ -442,6 +443,12 @@ def tests(
     type=IntRange(min=0),
     show_default=True,
 )
+@click.option(
+    "--skip-provider-tests",
+    help="Skip provider tests",
+    is_flag=True,
+    envvar="SKIP_PROVIDER_TESTS",
+)
 @option_db_reset
 @option_verbose
 @option_dry_run
@@ -454,6 +461,7 @@ def integration_tests(
     mssql_version: str,
     integration: tuple,
     test_timeout: int,
+    skip_provider_tests: bool,
     db_reset: bool,
     image_tag: str | None,
     mount_sources: str,
@@ -472,6 +480,7 @@ def integration_tests(
         mount_sources=mount_sources,
         forward_ports=False,
         test_type="Integration",
+        skip_provider_tests=skip_provider_tests,
     )
     cleanup_python_generated_files()
     returncode, _ = _run_test(
diff --git a/dev/breeze/src/airflow_breeze/params/shell_params.py b/dev/breeze/src/airflow_breeze/params/shell_params.py
index f69a950389..fad96e81f5 100644
--- a/dev/breeze/src/airflow_breeze/params/shell_params.py
+++ b/dev/breeze/src/airflow_breeze/params/shell_params.py
@@ -105,6 +105,7 @@ class ShellParams:
     skip_constraints: bool = False
     start_airflow: str = "false"
     test_type: str | None = None
+    skip_provider_tests: bool = False
     use_airflow_version: str | None = None
     use_packages_from_dist: bool = False
     version_suffix_for_pypi: str = ""
diff --git a/images/breeze/output-commands-hash.txt b/images/breeze/output-commands-hash.txt
index 5fa6522464..e580f65d33 100644
--- a/images/breeze/output-commands-hash.txt
+++ b/images/breeze/output-commands-hash.txt
@@ -59,6 +59,6 @@ static-checks:f45ad432bdc47a2256fdb0277b19d816
 stop:8969537ccdd799f692ccb8600a7bbed6
 testing:docker-compose-tests:b86c044b24138af0659a05ed6331576c
 testing:helm-tests:94a442e7f3f63b34c4831a84d165690a
-testing:integration-tests:4c8321c60b2112b12c866beebeb6c61b
+testing:integration-tests:585da1e636f710be9c9de36a71586963
 testing:tests:1b67704a3f8eae3a6db8d7c8d6cc162a
-testing:0614ca49c1b4c2b0b1d92c31278dc4f9
+testing:f07eb24d62e6628c0899d643ae3fe353
diff --git a/images/breeze/output_testing_integration-tests.svg b/images/breeze/output_testing_integration-tests.svg
index 42fe4cc6bb..9ebb331636 100644
--- a/images/breeze/output_testing_integration-tests.svg
+++ b/images/breeze/output_testing_integration-tests.svg
@@ -1,4 +1,4 @@
-<svg class="rich-terminal" viewBox="0 0 1482 806.4" xmlns="http://www.w3.org/2000/svg">
+<svg class="rich-terminal" viewBox="0 0 1482 830.8" xmlns="http://www.w3.org/2000/svg">
     <!-- Generated with Rich https://www.textualize.io -->
     <style>
 
@@ -43,7 +43,7 @@
 
     <defs>
     <clipPath id="breeze-testing-integration-tests-clip-terminal">
-      <rect x="0" y="0" width="1463.0" height="755.4" />
+      <rect x="0" y="0" width="1463.0" height="779.8" />
     </clipPath>
     <clipPath id="breeze-testing-integration-tests-line-0">
     <rect x="0" y="1.5" width="1464" height="24.65"/>
@@ -135,9 +135,12 @@
 <clipPath id="breeze-testing-integration-tests-line-29">
     <rect x="0" y="709.1" width="1464" height="24.65"/>
             </clipPath>
+<clipPath id="breeze-testing-integration-tests-line-30">
+    <rect x="0" y="733.5" width="1464" height="24.65"/>
+            </clipPath>
     </defs>
 
-    <rect fill="#292929" stroke="rgba(255,255,255,0.35)" stroke-width="1" x="1" y="1" width="1480" height="804.4" rx="8"/><text class="breeze-testing-integration-tests-title" fill="#c5c8c6" text-anchor="middle" x="740" y="27">Command:&#160;testing&#160;integration-tests</text>
+    <rect fill="#292929" stroke="rgba(255,255,255,0.35)" stroke-width="1" x="1" y="1" width="1480" height="828.8" rx="8"/><text class="breeze-testing-integration-tests-title" fill="#c5c8c6" text-anchor="middle" x="740" y="27">Command:&#160;testing&#160;integration-tests</text>
             <g transform="translate(26,22)">
             <circle cx="0" cy="0" r="7" fill="#ff5f57"/>
             <circle cx="22" cy="0" r="7" fill="#febc2e"/>
@@ -174,10 +177,11 @@
 </text><text class="breeze-testing-integration-tests-r5" x="0" y="605.6" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-24)">│</text><text class="breeze-testing-integration-tests-r5" x="280.6" y="605.6" textLength="1159" clip-path="url(#breeze-testing-integration-tests-line-24)">[default:&#160;selected]&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;& [...]
 </text><text class="breeze-testing-integration-tests-r5" x="0" y="630" textLength="1464" clip-path="url(#breeze-testing-integration-tests-line-25)">╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</text><text class="breeze-testing-integration-tests-r2" x="1464" y="630" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-25)">
 </text><text class="breeze-testing-integration-tests-r5" x="0" y="654.4" textLength="24.4" clip-path="url(#breeze-testing-integration-tests-line-26)">╭─</text><text class="breeze-testing-integration-tests-r5" x="24.4" y="654.4" textLength="195.2" clip-path="url(#breeze-testing-integration-tests-line-26)">&#160;Common&#160;options&#160;</text><text class="breeze-testing-integration-tests-r5" x="219.6" y="654.4" textLength="1220" clip-path="url(#breeze-testing-integration-tests-line-26)">─ [...]
-</text><text class="breeze-testing-integration-tests-r5" x="0" y="678.8" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-27)">│</text><text class="breeze-testing-integration-tests-r4" x="24.4" y="678.8" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-27)">-</text><text class="breeze-testing-integration-tests-r4" x="36.6" y="678.8" textLength="97.6" clip-path="url(#breeze-testing-integration-tests-line-27)">-verbose</text><text class="breeze [...]
-</text><text class="breeze-testing-integration-tests-r5" x="0" y="703.2" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-28)">│</text><text class="breeze-testing-integration-tests-r4" x="24.4" y="703.2" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-28)">-</text><text class="breeze-testing-integration-tests-r4" x="36.6" y="703.2" textLength="48.8" clip-path="url(#breeze-testing-integration-tests-line-28)">-dry</text><text class="breeze-tes [...]
-</text><text class="breeze-testing-integration-tests-r5" x="0" y="727.6" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-29)">│</text><text class="breeze-testing-integration-tests-r4" x="24.4" y="727.6" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-29)">-</text><text class="breeze-testing-integration-tests-r4" x="36.6" y="727.6" textLength="61" clip-path="url(#breeze-testing-integration-tests-line-29)">-help</text><text class="breeze-test [...]
-</text><text class="breeze-testing-integration-tests-r5" x="0" y="752" textLength="1464" clip-path="url(#breeze-testing-integration-tests-line-30)">╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</text><text class="breeze-testing-integration-tests-r2" x="1464" y="752" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-30)">
+</text><text class="breeze-testing-integration-tests-r5" x="0" y="678.8" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-27)">│</text><text class="breeze-testing-integration-tests-r4" x="24.4" y="678.8" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-27)">-</text><text class="breeze-testing-integration-tests-r4" x="36.6" y="678.8" textLength="61" clip-path="url(#breeze-testing-integration-tests-line-27)">-skip</text><text class="breeze-test [...]
+</text><text class="breeze-testing-integration-tests-r5" x="0" y="703.2" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-28)">│</text><text class="breeze-testing-integration-tests-r4" x="24.4" y="703.2" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-28)">-</text><text class="breeze-testing-integration-tests-r4" x="36.6" y="703.2" textLength="97.6" clip-path="url(#breeze-testing-integration-tests-line-28)">-verbose</text><text class="breeze [...]
+</text><text class="breeze-testing-integration-tests-r5" x="0" y="727.6" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-29)">│</text><text class="breeze-testing-integration-tests-r4" x="24.4" y="727.6" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-29)">-</text><text class="breeze-testing-integration-tests-r4" x="36.6" y="727.6" textLength="48.8" clip-path="url(#breeze-testing-integration-tests-line-29)">-dry</text><text class="breeze-tes [...]
+</text><text class="breeze-testing-integration-tests-r5" x="0" y="752" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-30)">│</text><text class="breeze-testing-integration-tests-r4" x="24.4" y="752" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-30)">-</text><text class="breeze-testing-integration-tests-r4" x="36.6" y="752" textLength="61" clip-path="url(#breeze-testing-integration-tests-line-30)">-help</text><text class="breeze-testing-in [...]
+</text><text class="breeze-testing-integration-tests-r5" x="0" y="776.4" textLength="1464" clip-path="url(#breeze-testing-integration-tests-line-31)">╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</text><text class="breeze-testing-integration-tests-r2" x="1464" y="776.4" textLength="12.2" clip-path="url(#breeze-testing-integration-tests-line-31)">
 </text>
     </g>
     </g>
diff --git a/scripts/ci/docker-compose/_docker.env b/scripts/ci/docker-compose/_docker.env
index 34b9381f81..dbea935eea 100644
--- a/scripts/ci/docker-compose/_docker.env
+++ b/scripts/ci/docker-compose/_docker.env
@@ -59,6 +59,7 @@ RUN_SYSTEM_TESTS
 START_AIRFLOW
 SKIP_CONSTRAINTS
 SKIP_ENVIRONMENT_INITIALIZATION
+SKIP_PROVIDER_TESTS
 SKIP_SSH_SETUP
 TEST_TIMEOUT
 TEST_TYPE
diff --git a/scripts/ci/docker-compose/base.yml b/scripts/ci/docker-compose/base.yml
index ea95ede5f5..7f11966b30 100644
--- a/scripts/ci/docker-compose/base.yml
+++ b/scripts/ci/docker-compose/base.yml
@@ -72,6 +72,7 @@ services:
       - START_AIRFLOW=${START_AIRFLOW}
       - SKIP_CONSTRAINTS=${SKIP_CONSTRAINTS}
       - SKIP_ENVIRONMENT_INITIALIZATION=${SKIP_ENVIRONMENT_INITIALIZATION}
+      - SKIP_PROVIDER_TESTS=${SKIP_PROVIDER_TESTS}
       - SKIP_SSH_SETUP=${SKIP_SSH_SETUP}
       - TEST_TYPE=${TEST_TYPE}
       - TEST_TIMEOUT=${TEST_TIMEOUT}
diff --git a/scripts/docker/entrypoint_ci.sh b/scripts/docker/entrypoint_ci.sh
index 190995590d..76ccbdeab7 100755
--- a/scripts/docker/entrypoint_ci.sh
+++ b/scripts/docker/entrypoint_ci.sh
@@ -378,6 +378,13 @@ else
         "${WWW_TESTS[@]}"
     )
 
+    NO_PROVIDERS_INTEGRATION_TESTS=(
+        "tests/integration/api"
+        "tests/integration/cli"
+        "tests/integration/executors"
+        "tests/integration/security"
+    )
+
     if [[ ${TEST_TYPE:=""} == "CLI" ]]; then
         SELECTED_TESTS=("${CLI_TESTS[@]}")
     elif [[ ${TEST_TYPE:=""} == "API" ]]; then
@@ -393,7 +400,11 @@ else
     elif [[ ${TEST_TYPE:=""} == "Helm" ]]; then
         SELECTED_TESTS=("${HELM_CHART_TESTS[@]}")
     elif [[ ${TEST_TYPE:=""} == "Integration" ]]; then
-        SELECTED_TESTS=("${INTEGRATION_TESTS[@]}")
+        if [[ ${SKIP_PROVIDER_TESTS:=""} == "true" ]]; then
+            SELECTED_TESTS=("${NO_PROVIDERS_INTEGRATION_TESTS[@]}")
+        else
+            SELECTED_TESTS=("${INTEGRATION_TESTS[@]}")
+        fi
     elif [[ ${TEST_TYPE:=""} == "Other" ]]; then
         find_all_other_tests
         SELECTED_TESTS=("${ALL_OTHER_TESTS[@]}")