From 0214a66ede3b251dc277c4db3c94fdc123e1bee0 Mon Sep 17 00:00:00 2001 From: Pankaj Koti Date: Thu, 19 Mar 2026 16:24:15 +0530 Subject: [PATCH 1/5] Isolate Scarf telemetry integration test into its own CI job This prevents flaky telemetry tests from impacting the main integration test suite and makes them easy to retry independently. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/test.yml | 49 +++++++++++++++++++++++++++++++++++++ pyproject.toml | 1 + scripts/test/integration.sh | 1 + scripts/test/telemetry.sh | 12 +++++++++ 4 files changed, 63 insertions(+) create mode 100755 scripts/test/telemetry.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c0f390bcc7..db96454f89 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -588,6 +588,55 @@ jobs: RESOURCE_PREFIX: ${{ steps.set-resource-prefix.outputs.prefix }} + Run-Telemetry-Tests: + needs: [Authorize, Check-changed-files] + if: needs.Check-changed-files.outputs.code_changed == 'true' + runs-on: ubuntu-latest + permissions: + contents: read + strategy: + fail-fast: false + matrix: + python-version: ["3.11"] + airflow-version: ["2.10"] + dbt-version: ["1.9"] + env: + SCARF_NO_ANALYTICS: "false" + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + persist-credentials: false + + - uses: actions/cache@v5 + with: + path: | + ~/.cache/pip + .local/share/hatch/ + key: telemetry-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ matrix.dbt-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('cosmos/__init__.py') }} + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + + - name: Install packages and dependencies + run: | + python -m pip install uv + uv pip install --system "hatch>=1.14.2" + hatch -e tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ matrix.dbt-version }} run pip freeze + + - name: Run telemetry tests + run: | + hatch run tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ matrix.dbt-version }}:test-telemetry + + - name: Upload coverage to Github + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: coverage-telemetry-test-${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ matrix.dbt-version }} + path: .coverage + include-hidden-files: true + Run-Performance-Tests: needs: [Authorize, Check-changed-files] if: needs.Check-changed-files.outputs.code_changed == 'true' diff --git a/pyproject.toml b/pyproject.toml index ac67e17358..9ee9dc0be1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -194,6 +194,7 @@ test-integration-dbtf = 'sh scripts/test/integration-dbtf.sh' test-integration-dbt-1-5-4 = 'sh scripts/test/integration-dbt-1-5-4.sh' test-integration-dbt-async = 'sh scripts/test/integration-dbt-async.sh {matrix:dbt}' test-integration-expensive = 'sh scripts/test/integration-expensive.sh' +test-telemetry = 'sh scripts/test/telemetry.sh' test-performance = 'sh scripts/test/performance.sh' test-performance-setup = 'sh scripts/test/performance-setup.sh {matrix:dbt}' diff --git a/scripts/test/integration.sh b/scripts/test/integration.sh index efd6c9ade7..dbe37f8103 100644 --- a/scripts/test/integration.sh +++ b/scripts/test/integration.sh @@ -24,4 +24,5 @@ pytest -vv \ --ignore=tests/test_example_k8s_dags.py \ --ignore=tests/operators/test_watcher_kubernetes_integration.py \ --ignore=dev/dags/cross_project_dbt_ls_dag.py \ + --ignore=tests/test_telemetry.py \ -k 'not (simple_dag_async or example_cosmos_python_models or example_virtualenv or jaffle_shop_kubernetes or jaffle_shop_watcher_kubernetes)' diff --git a/scripts/test/telemetry.sh b/scripts/test/telemetry.sh new file mode 100755 index 0000000000..15ef05d519 --- /dev/null +++ b/scripts/test/telemetry.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -x +set -e + +pytest -vv \ + --cov=cosmos \ + --cov-report=term-missing \ + --cov-report=xml \ + --durations=0 \ + -m integration \ + tests/test_telemetry.py From 81fc884b5b5d3b7f4a9d68bf5514503b11f76812 Mon Sep 17 00:00:00 2001 From: Pankaj Koti Date: Thu, 19 Mar 2026 16:27:27 +0530 Subject: [PATCH 2/5] Temporarily add issue-2385 branch to push trigger for CI validation To be reverted before merging to main. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db96454f89..c1ba6ce27a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: test on: push: # Run on pushes to the default branch - branches: [main] + branches: [main, issue-2385] # Also run on pull requests originating from forks. Although this is insecure by default, we need it to run # integration tests on forked PRs. As a guardrail, we’ve added an Authorize step to each job, which requires manually # approving the workflow run for each pushed commit. Approval only happens after a careful code review of the changes. From 1ee589a1d3064c361b36e9f680ac485f392a38df Mon Sep 17 00:00:00 2001 From: Pankaj Koti Date: Thu, 19 Mar 2026 16:47:39 +0530 Subject: [PATCH 3/5] Pin actions to commit hashes in Run-Telemetry-Tests job Fixes zizmor unpinned-uses alerts for actions/cache and actions/setup-python. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1ba6ce27a..e3ec96b4c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -608,7 +608,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.ref }} persist-credentials: false - - uses: actions/cache@v5 + - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 with: path: | ~/.cache/pip @@ -616,7 +616,7 @@ jobs: key: telemetry-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ matrix.dbt-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('cosmos/__init__.py') }} - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: ${{ matrix.python-version }} From c07ceed81d600743821a59fd12a63a63c962b0c1 Mon Sep 17 00:00:00 2001 From: Pankaj Koti Date: Thu, 19 Mar 2026 16:51:53 +0530 Subject: [PATCH 4/5] Apply suggestion from @pankajkoti --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3ec96b4c1..74488f6eac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: test on: push: # Run on pushes to the default branch - branches: [main, issue-2385] + branches: [main] # Also run on pull requests originating from forks. Although this is insecure by default, we need it to run # integration tests on forked PRs. As a guardrail, we’ve added an Authorize step to each job, which requires manually # approving the workflow run for each pushed commit. Approval only happens after a careful code review of the changes. From 7d1b113a4e04ff0ffc6b2ed06626d9222fb4339e Mon Sep 17 00:00:00 2001 From: Pankaj Koti Date: Thu, 19 Mar 2026 16:57:38 +0530 Subject: [PATCH 5/5] Add Run-Telemetry-Tests to Code-Coverage job dependencies Ensures the telemetry coverage artifact is always available before the combine step runs. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 74488f6eac..a12e16a452 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -793,6 +793,7 @@ jobs: - Run-Integration-Tests - Run-Integration-Tests-Expensive - Run-Kubernetes-Tests + - Run-Telemetry-Tests runs-on: ubuntu-latest permissions: contents: read