Skip to content

Commit 736e005

Browse files
committed
test: Verify transform-on-write features are materialized by the local template
Extend test_repo_init so that, after feast apply and feast materialize on a freshly initialized repo, the features of the write_to_online_store on demand feature view can be read back from the online store. This covers the full CLI path (plan-based apply on the local provider) end to end. Part of feast-dev#5478 Signed-off-by: ryota717 <[email protected]>
1 parent eb20131 commit 736e005

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎sdk/python/tests/unit/local_feast_tests/test_init.py‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
from pathlib import Path
44
from textwrap import dedent
55

6+
from feast import FeatureStore
67
from feast.utils import _utc_now
78
from tests.utils.cli_repo_creator import CliRunner
89

910

1011
def test_repo_init() -> None:
1112
"""
1213
This test simply makes sure that you can run `feast apply && feast materialize` on
13-
the repo created by "feast init" without errors.
14+
the repo created by "feast init" without errors, and that the transform-on-write
15+
on demand feature view in the template is materialized along the way.
1416
"""
1517
runner = CliRunner()
1618
with tempfile.TemporaryDirectory() as temp_dir:
@@ -28,6 +30,19 @@ def test_repo_init() -> None:
2830
)
2931
assert result.returncode == 0
3032

33+
# `feast apply` goes through the plan path on the local provider, so this also
34+
# verifies that the sqlite table for the write_to_online_store ODFV was created.
35+
store = FeatureStore(repo_path=str(repo_path))
36+
response = store.get_online_features(
37+
features=[
38+
"transformed_conv_rate_on_write:conv_rate_x_acc_rate",
39+
"transformed_conv_rate_on_write:expected_daily_conversions",
40+
],
41+
entity_rows=[{"driver_id": 1001}],
42+
).to_dict()
43+
assert response["conv_rate_x_acc_rate"][0] is not None
44+
assert response["expected_daily_conversions"][0] is not None
45+
3146

3247
def test_repo_init_with_underscore_in_project_name() -> None:
3348
"""

0 commit comments

Comments
 (0)