Skip to content

Commit c2f9175

Browse files
committed
test: Add comprehensive multi-entity integration tests for dbt
Add three levels of multi-entity integration tests using real CLI workflows: 1. Easy scenario (test_multi_entity_easy_cli_workflow): - 2 entities (user_id, product_id) - Basic feast dbt import with validation - Tests user_product_interactions model 2. Medium scenario (test_multi_entity_medium_cli_with_validation): - 3 entities (user_id, merchant_id, location_id) - Multiple imports with entity validation - Code generation testing with --output flag - Tests transaction_features model 3. Complex scenario (test_multi_entity_complex_full_workflow): - 4 unique entities with reuse across models - Tests user_merchant_txn, user_product_views, merchant_location_stats - Full registry validation - Entity reuse verification Test infrastructure: - conftest.py: Skips tests if manifest.json missing (requires dbt build) - pytest.ini: Configures test markers and isolation - 6 dbt models with multi-entity configurations - 5 seed CSV files for test data All tests use subprocess to run actual feast CLI commands, not mocks. Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
1 parent ad1848a commit c2f9175

17 files changed

+1540
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""dbt integration tests."""
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
Conftest for dbt integration tests.
3+
4+
This is a standalone conftest that doesn't depend on the main Feast test infrastructure.
5+
"""
6+
7+
from pathlib import Path
8+
9+
import pytest
10+
11+
# This conftest is minimal and doesn't import the main feast conftest
12+
# to avoid complex dependency chains for dbt-specific tests
13+
14+
# Path to the test dbt project manifest
15+
TEST_DBT_PROJECT_DIR = Path(__file__).parent / "test_dbt_project"
16+
TEST_MANIFEST_PATH = TEST_DBT_PROJECT_DIR / "target" / "manifest.json"
17+
18+
19+
def pytest_collection_modifyitems(config, items): # noqa: ARG001
20+
"""
21+
Skip dbt integration tests if manifest.json doesn't exist.
22+
23+
These tests require running 'dbt build' first to generate the manifest.
24+
The dbt-integration-test workflow handles this, but regular unit test
25+
runs don't, so we skip them to avoid failures.
26+
"""
27+
if not TEST_MANIFEST_PATH.exists():
28+
skip_marker = pytest.mark.skip(
29+
reason="dbt manifest.json not found - run 'dbt build' first or use dbt-integration-test workflow"
30+
)
31+
for item in items:
32+
item.add_marker(skip_marker)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[pytest]
2+
# Prevent loading parent conftest.py files which may import heavy dependencies
3+
# like ray that are not needed for dbt integration tests
4+
norecursedirs = ..
5+
asyncio_mode = auto
6+
7+
# Test markers
8+
markers =
9+
dbt: dbt integration tests

0 commit comments

Comments
 (0)