Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests
Signed-off-by: Prathap P <436prathap@gmail.com>
  • Loading branch information
Prathap-P authored and ntkathole committed Mar 6, 2026
commit 8363cd48fe4d9f61d7c7ba6d5950c19b661ec2f6
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from pytest_lazyfixture import lazy_fixture

from feast import FileSource
from feast.data_format import AvroFormat
from feast.data_source import KafkaSource
from feast.entity import Entity
from feast.errors import ConflictingFeatureViewNames
from feast.feature_store import FeatureStore, _validate_feature_views
Expand Down Expand Up @@ -83,6 +85,7 @@ def feature_store_with_local_registry():
)


@pytest.mark.integration
def test_validate_feature_views_cross_type_conflict():
"""
Test that _validate_feature_views() catches cross-type name conflicts.
Expand All @@ -107,12 +110,21 @@ def test_validate_feature_views_cross_type_conflict():
)

# Create a StreamFeatureView with the SAME name
stream_source = KafkaSource(
name="kafka",
timestamp_field="event_timestamp",
kafka_bootstrap_servers="",
message_format=AvroFormat(""),
topic="topic",
batch_source=file_source,
watermark_delay_threshold=timedelta(days=1),
)
stream_feature_view = StreamFeatureView(
name="my_feature_view", # Same name as FeatureView!
entities=[entity],
ttl=timedelta(days=30),
schema=[Field(name="feature1", dtype=Float32)],
source=file_source,
source=stream_source,
)

# Validate should raise ConflictingFeatureViewNames
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,12 @@ def test_commit_for_read_only_user():


@pytest.mark.integration
@pytest.mark.parametrize("test_registry", all_fixtures)
@pytest.mark.parametrize(
"test_registry",
# mock_remote_registry excluded: the mock gRPC channel does not propagate
# server-side errors, so ConflictingFeatureViewNames is not raised client-side.
[f for f in all_fixtures if "mock_remote" not in str(f)],
)
def test_cross_type_feature_view_name_conflict(test_registry: BaseRegistry):
"""
Test that feature view names must be unique across all feature view types.
Expand Down Expand Up @@ -2061,16 +2066,17 @@ def simple_udf(x: int):
# Verify error message contains the conflicting types
error_message = str(exc_info.value)
assert "shared_feature_view_name" in error_message
assert "FeatureView" in error_message
assert "StreamFeatureView" in error_message

# Cleanup
test_registry.delete_feature_view("shared_feature_view_name", project)
test_registry.teardown()


@pytest.mark.integration
@pytest.mark.parametrize("test_registry", all_fixtures)
@pytest.mark.parametrize(
"test_registry",
[f for f in all_fixtures if "mock_remote" not in str(f)],
)
def test_cross_type_feature_view_odfv_conflict(test_registry: BaseRegistry):
"""
Test that OnDemandFeatureView names must be unique across all feature view types.
Expand Down Expand Up @@ -2107,8 +2113,6 @@ def shared_odfv_name(inputs: pd.DataFrame) -> pd.DataFrame:
# Verify error message contains the conflicting types
error_message = str(exc_info.value)
assert "shared_odfv_name" in error_message
assert "FeatureView" in error_message
assert "OnDemandFeatureView" in error_message

# Cleanup
test_registry.delete_feature_view("shared_odfv_name", project)
Expand Down
6 changes: 3 additions & 3 deletions sdk/python/tests/unit/cli/test_cli_apply_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def test_cli_apply_duplicated_featureview_names() -> None:
run_simple_apply_test(
example_repo_file_name="example_feature_repo_with_duplicated_featureview_names.py",
expected_error=b"Please ensure that all feature view names are case-insensitively unique",
expected_error=b"Feature view names must be case-insensitively unique",
)


Expand Down Expand Up @@ -153,7 +153,7 @@ def test_cli_apply_imported_featureview_with_duplication() -> None:

assert rc != 0
assert (
b"More than one feature view with name driver_hourly_stats found." in output
b"Multiple FeatureViews with name 'driver_hourly_stats' found." in output
)


Expand Down Expand Up @@ -195,6 +195,6 @@ def test_cli_apply_duplicated_featureview_names_multiple_py_files() -> None:

assert (
rc != 0
and b"Please ensure that all feature view names are case-insensitively unique"
and b"Feature view names must be case-insensitively unique"
in output
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from feast.data_format import AvroFormat, ParquetFormat
from feast.data_source import KafkaSource
from feast.entity import Entity
from feast.errors import ConflictingFeatureViewNames
from feast.feast_object import ALL_RESOURCE_TYPES
from feast.feature_store import FeatureStore
from feast.feature_view import DUMMY_ENTITY_ID, DUMMY_ENTITY_NAME, FeatureView
Expand Down Expand Up @@ -534,16 +535,10 @@ def test_apply_conflicting_feature_view_names(feature_store_with_local_registry)
source=FileSource(path="customer_stats.parquet"),
tags={},
)
try:
with pytest.raises(ConflictingFeatureViewNames) as exc_info:
feature_store_with_local_registry.apply([driver_stats, customer_stats])
error = None
except ValueError as e:
error = e
assert (
isinstance(error, ValueError)
and "Please ensure that all feature view names are case-insensitively unique"
in error.args[0]
)

assert "Feature view names must be case-insensitively unique" in str(exc_info.value)

feature_store_with_local_registry.teardown()

Expand Down