-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Add integration tests for dbt import #5899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: dbt-integration-tests | ||
|
|
||
| # Run dbt integration tests on PRs | ||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| - labeled | ||
| paths: | ||
| - 'sdk/python/feast/dbt/**' | ||
| - 'sdk/python/tests/integration/dbt/**' | ||
| - 'sdk/python/tests/unit/dbt/**' | ||
| - '.github/workflows/dbt-integration-tests.yml' | ||
|
|
||
| jobs: | ||
| dbt-integration-test: | ||
| if: | ||
| ((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) || | ||
| (github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) && | ||
| github.event.pull_request.base.repo.full_name == 'feast-dev/feast' | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.11", "3.12"] | ||
| env: | ||
| PYTHON: ${{ matrix.python-version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| architecture: x64 | ||
|
|
||
| - name: Install the latest version of uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| enable-cache: true | ||
|
|
||
| - name: Install dependencies | ||
| run: make install-python-dependencies-ci | ||
|
|
||
| - name: Install dbt and dbt-duckdb | ||
| run: | | ||
| uv pip install --system dbt-core dbt-duckdb | ||
|
|
||
| - name: Run dbt integration tests | ||
| run: make test-python-integration-dbt | ||
|
|
||
| - name: Minimize uv cache | ||
| run: uv cache prune --ci | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -187,6 +187,28 @@ test-python-integration-container: ## Run Python integration tests using Docker | |||||
| python -m pytest -n 8 --integration sdk/python/tests \ | ||||||
| ) || echo "This script uses Docker, and it isn't running - please start the Docker Daemon and try again!"; | ||||||
|
|
||||||
| test-python-integration-dbt: ## Run dbt integration tests | ||||||
| @echo "Running dbt integration tests..." | ||||||
| @cd sdk/python/tests/integration/dbt/test_dbt_project && \ | ||||||
| echo "Installing dbt dependencies..." && \ | ||||||
| dbt deps && \ | ||||||
| echo "Building dbt models..." && \ | ||||||
| dbt build | ||||||
| @cd sdk/python/tests/integration/dbt && \ | ||||||
| echo "Setting up Feast project..." && \ | ||||||
| mkdir -p feast_repo/data && \ | ||||||
| echo "project: feast_dbt_test\nregistry: data/registry.db\nprovider: local\nonline_store:\n type: sqlite\n path: data/online_store.db" > feast_repo/feature_store.yaml | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Makefile The Root Cause and ImpactThe command: On Ubuntu CI, This is a single line of invalid YAML, causing Impact:
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||
| @cd sdk/python/tests/integration/dbt/feast_repo && \ | ||||||
| echo "Testing feast dbt import..." && \ | ||||||
| feast dbt import -m ../test_dbt_project/target/manifest.json -e driver_id -d file --tag feast && \ | ||||||
| echo "Verifying Feast objects..." && \ | ||||||
| feast feature-views list && \ | ||||||
| feast entities list | ||||||
| @cd sdk/python && \ | ||||||
| echo "Running pytest integration tests..." && \ | ||||||
| python -m pytest tests/integration/dbt/test_dbt_integration.py -v --tb=short | ||||||
| @echo "✓ dbt integration tests completed successfully!" | ||||||
|
|
||||||
| test-python-universal-spark: ## Run Python Spark integration tests | ||||||
| PYTHONPATH='.' \ | ||||||
| FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.offline_stores.contrib.spark_repo_configuration \ | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Integration tests for dbt import functionality |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| """ | ||
| Conftest for dbt integration tests. | ||
|
|
||
| This is a standalone conftest that doesn't depend on the main Feast test infrastructure. | ||
| """ | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| # This conftest is minimal and doesn't import the main feast conftest | ||
| # to avoid complex dependency chains for dbt-specific tests | ||
|
|
||
| # Path to the test dbt project manifest | ||
| TEST_DBT_PROJECT_DIR = Path(__file__).parent / "test_dbt_project" | ||
| TEST_MANIFEST_PATH = TEST_DBT_PROJECT_DIR / "target" / "manifest.json" | ||
|
|
||
|
|
||
| def pytest_collection_modifyitems(config, items): # noqa: ARG001 | ||
| """ | ||
| Skip dbt integration tests if manifest.json doesn't exist. | ||
|
|
||
| These tests require running 'dbt build' first to generate the manifest. | ||
| The dbt-integration-test workflow handles this, but regular unit test | ||
| runs don't, so we skip them to avoid failures. | ||
| """ | ||
| if not TEST_MANIFEST_PATH.exists(): | ||
| skip_marker = pytest.mark.skip( | ||
| reason="dbt manifest.json not found - run 'dbt build' first or use dbt-integration-test workflow" | ||
| ) | ||
| for item in items: | ||
| item.add_marker(skip_marker) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [pytest] | ||
| # Prevent loading parent conftest.py files which may import heavy dependencies | ||
| # like ray that are not needed for dbt integration tests | ||
| norecursedirs = .. | ||
| asyncio_mode = auto | ||
|
|
||
| # Test markers | ||
| markers = | ||
| dbt: dbt integration tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have a check for ok-to-test label so that resources don't get spin up for every PR raised, similar to other integration tests pattern
https://github.com/feast-dev/feast/blob/master/.github/workflows/pr_local_integration_tests.yml#L13