Skip to content

Commit

Permalink
Switch tests in ci to use Python Breeze
Browse files Browse the repository at this point in the history
This is the last big change in "Rewrite Breeze to Python".

Fixes: #23538
  • Loading branch information
potiuk committed Oct 3, 2022
1 parent 6ddb646 commit 9bf2d71
Show file tree
Hide file tree
Showing 73 changed files with 3,081 additions and 3,482 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ jobs:
default-constraints-branch: ${{ steps.selective-checks.outputs.default-constraints-branch }}
docs-filter: ${{ steps.selective-checks.outputs.docs-filter }}
skip-pre-commits: ${{ steps.selective-checks.outputs.skip-pre-commits }}
debug-resources: ${{ steps.selective-checks.outputs.debug-resources }}
source-head-repo: ${{ steps.source-run-info.outputs.source-head-repo }}
pull-request-labels: ${{ steps.source-run-info.outputs.pr-labels }}
in-workflow-build: ${{ steps.source-run-info.outputs.in-workflow-build }}
Expand Down Expand Up @@ -1059,10 +1060,11 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
- name: "Test Offline SQL generation"
run: ./scripts/ci/testing/run_offline_sql_test.sh
- name: "Tests: ${{needs.build-info.outputs.test-types}}"
run: ./scripts/ci/testing/ci_run_airflow_testing.sh
run: breeze testing tests --run-in-parallel
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
DEBUG_RESOURCES: ${{ needs.build-info.outputs.debug-resources }}
- name: "Upload airflow logs"
uses: actions/upload-artifact@v3
if: failure()
Expand Down Expand Up @@ -1130,10 +1132,11 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
- name: "Test downgrade"
run: ./scripts/ci/testing/run_downgrade_test.sh
- name: "Tests: ${{needs.build-info.outputs.test-types}}"
run: ./scripts/ci/testing/ci_run_airflow_testing.sh
run: breeze testing tests --run-in-parallel
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
DEBUG_RESOURCES: ${{ needs.build-info.outputs.debug-resources }}
- name: "Upload airflow logs"
uses: actions/upload-artifact@v3
if: failure()
Expand Down Expand Up @@ -1201,10 +1204,11 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
- name: "Test downgrade"
run: ./scripts/ci/testing/run_downgrade_test.sh
- name: "Tests: ${{needs.build-info.outputs.test-types}}"
run: ./scripts/ci/testing/ci_run_airflow_testing.sh
run: breeze testing tests --run-in-parallel
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
DEBUG_RESOURCES: ${{ needs.build-info.outputs.debug-resources }}
- name: "Upload airflow logs"
uses: actions/upload-artifact@v3
if: failure()
Expand Down Expand Up @@ -1270,10 +1274,11 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
- name: "Test downgrade"
run: ./scripts/ci/testing/run_downgrade_test.sh
- name: "Tests: ${{needs.build-info.outputs.test-types}}"
run: ./scripts/ci/testing/ci_run_airflow_testing.sh
run: breeze testing tests --run-in-parallel
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
DEBUG_RESOURCES: ${{ needs.build-info.outputs.debug-resources }}
- name: "Upload airflow logs"
uses: actions/upload-artifact@v3
if: failure()
Expand Down Expand Up @@ -1309,7 +1314,6 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
RUNS_ON: ${{ needs.build-info.outputs.runs-on }}
MYSQL_VERSION: ${{needs.build-info.outputs.default-mysql-version}}
POSTGRES_VERSION: ${{needs.build-info.outputs.default-postgres-version}}
TEST_TYPES: "Quarantined"
PYTHON_MAJOR_MINOR_VERSION: ${{ needs.build-info.outputs.default-python-version }}
if: needs.build-info.outputs.run-tests == 'true'
steps:
Expand Down Expand Up @@ -1345,9 +1349,12 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Tests: Quarantined"
run: ./scripts/ci/testing/ci_run_quarantined_tests.sh
run: breeze testing tests --run-in-parallel || true
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
TEST_TYPES: "Quarantined"
DEBUG_RESOURCES: ${{ needs.build-info.outputs.debug-resources }}
- name: "Upload Quarantine test results"
uses: actions/upload-artifact@v3
if: always()
Expand Down
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -798,16 +798,17 @@ repos:
files: newsfragments/.*\.rst
entry: ./scripts/ci/pre_commit/pre_commit_newsfragments.py
pass_filenames: true
# We sometimes won't have newsfragments in the repo, so always run it so `check-hooks-apply` passes
# This is fast, so not too much downside
always_run: true
- id: update-breeze-cmd-output
name: Update output of breeze commands in BREEZE.rst
entry: ./scripts/ci/pre_commit/pre_commit_breeze_cmd_line.py
language: python
files: ^BREEZE\.rst$|^dev/breeze/.*$|^\.pre-commit-config\.yaml$
require_serial: true
pass_filenames: false
additional_dependencies: ['rich>=12.4.4', 'rich-click>=1.5']
# We sometimes won't have newsfragments in the repo, so always run it so `check-hooks-apply` passes
# This is fast, so not too much downside
always_run: true
- id: check-example-dags-urls
name: Check that example dags url include provider versions
entry: ./scripts/ci/pre_commit/pre_commit_update_example_dags_paths.py
Expand Down
21 changes: 18 additions & 3 deletions BREEZE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,24 @@ API, Providers. This how our CI runs them - running each group in parallel to ot
replicate this behaviour.

Another interesting use of the ``breeze testing tests`` command is that you can easily specify sub-set of the
tests for Providers. ``breeze testing tests --test-type "Providers[airbyte,http]`` for example will only run
tests for airbyte and http providers.
tests for Providers.

For example this will only run provider tests for airbyte and http providers:

.. code-block:: bash
breeze testing tests --test-type "Providers[airbyte,http]``
You can also run parallel tests with ``--run-in-parallel`` flag - by default it will run all tests types
in parallel, but you can specify the test type that you want to run with space separated list of test
types passed to ``--test-types`` flag.
For example this will run API and WWW tests in parallel:
.. code-block:: bash
breeze testing tests --test-types "API WWW" --run-in-parallel
Here is the detailed set of options for the ``breeze testing tests`` command.
Expand Down Expand Up @@ -747,7 +763,6 @@ You can:
* Enter the interactive kubernetes test environment with ``breeze k8s shell`` and ``breeze k8s k9s`` command
* Run multi-cluster-operations ``breeze k8s list-all-clusters`` and
``breeze k8s delete-all-clusters`` commands as well as running complete tests in parallel
via ``breeze k8s run-complete-tests`` and export logs from all clusters to a temp directory
via ``breeze k8s dump-logs`` command
This is described in detail in `Testing Kubernetes <TESTING.rst#running-tests-with-kubernetes>`_.
Expand Down
Loading

0 comments on commit 9bf2d71

Please sign in to comment.