33
33
from tests .utils .data_source_test_creator import prep_file_source
34
34
35
35
36
- @pytest .mark .integration
37
- @pytest .mark .parametrize (
38
- "test_feature_store" ,
39
- [
40
- lazy_fixture ("feature_store_with_gcs_registry" ),
41
- lazy_fixture ("feature_store_with_s3_registry" ),
42
- ],
43
- )
44
- def test_apply_entity_integration (test_feature_store ):
45
- entity = Entity (
46
- name = "driver_car_id" ,
47
- description = "Car driver id" ,
48
- tags = {"team" : "matchmaking" },
49
- )
50
-
51
- # Register Entity
52
- test_feature_store .apply ([entity ])
53
-
54
- entities = test_feature_store .list_entities ()
55
-
56
- entity = entities [0 ]
57
- assert (
58
- len (entities ) == 1
59
- and entity .name == "driver_car_id"
60
- and entity .description == "Car driver id"
61
- and "team" in entity .tags
62
- and entity .tags ["team" ] == "matchmaking"
63
- )
64
-
65
- entity = test_feature_store .get_entity ("driver_car_id" )
66
- assert (
67
- entity .name == "driver_car_id"
68
- and entity .description == "Car driver id"
69
- and "team" in entity .tags
70
- and entity .tags ["team" ] == "matchmaking"
71
- )
72
-
73
- test_feature_store .teardown ()
74
-
75
-
76
36
@pytest .mark .integration
77
37
@pytest .mark .parametrize (
78
38
"test_feature_store" ,
@@ -108,82 +68,6 @@ def test_feature_view_inference_success(test_feature_store, dataframe_source):
108
68
109
69
test_feature_store .teardown ()
110
70
111
-
112
- @pytest .mark .integration
113
- @pytest .mark .parametrize (
114
- "test_feature_store" ,
115
- [
116
- lazy_fixture ("feature_store_with_gcs_registry" ),
117
- lazy_fixture ("feature_store_with_s3_registry" ),
118
- ],
119
- )
120
- def test_apply_feature_view_integration (test_feature_store ):
121
- # Create Feature Views
122
- batch_source = FileSource (
123
- file_format = ParquetFormat (),
124
- path = "file://feast/*" ,
125
- timestamp_field = "ts_col" ,
126
- created_timestamp_column = "timestamp" ,
127
- )
128
-
129
- entity = Entity (name = "fs1_my_entity_1" , join_keys = ["test" ])
130
-
131
- fv1 = FeatureView (
132
- name = "my_feature_view_1" ,
133
- schema = [
134
- Field (name = "fs1_my_feature_1" , dtype = Int64 ),
135
- Field (name = "fs1_my_feature_2" , dtype = String ),
136
- Field (name = "fs1_my_feature_3" , dtype = Array (String )),
137
- Field (name = "fs1_my_feature_4" , dtype = Array (Bytes )),
138
- Field (name = "test" , dtype = Int64 ),
139
- ],
140
- entities = [entity ],
141
- tags = {"team" : "matchmaking" },
142
- source = batch_source ,
143
- ttl = timedelta (minutes = 5 ),
144
- )
145
-
146
- # Register Feature View
147
- test_feature_store .apply ([fv1 , entity ])
148
-
149
- feature_views = test_feature_store .list_feature_views ()
150
-
151
- # List Feature Views
152
- assert (
153
- len (feature_views ) == 1
154
- and feature_views [0 ].name == "my_feature_view_1"
155
- and feature_views [0 ].features [0 ].name == "fs1_my_feature_1"
156
- and feature_views [0 ].features [0 ].dtype == Int64
157
- and feature_views [0 ].features [1 ].name == "fs1_my_feature_2"
158
- and feature_views [0 ].features [1 ].dtype == String
159
- and feature_views [0 ].features [2 ].name == "fs1_my_feature_3"
160
- and feature_views [0 ].features [2 ].dtype == Array (String )
161
- and feature_views [0 ].features [3 ].name == "fs1_my_feature_4"
162
- and feature_views [0 ].features [3 ].dtype == Array (Bytes )
163
- and feature_views [0 ].entities [0 ] == "fs1_my_entity_1"
164
- )
165
-
166
- feature_view = test_feature_store .get_feature_view ("my_feature_view_1" )
167
- assert (
168
- feature_view .name == "my_feature_view_1"
169
- and feature_view .features [0 ].name == "fs1_my_feature_1"
170
- and feature_view .features [0 ].dtype == Int64
171
- and feature_view .features [1 ].name == "fs1_my_feature_2"
172
- and feature_view .features [1 ].dtype == String
173
- and feature_view .features [2 ].name == "fs1_my_feature_3"
174
- and feature_view .features [2 ].dtype == Array (String )
175
- and feature_view .features [3 ].name == "fs1_my_feature_4"
176
- and feature_view .features [3 ].dtype == Array (Bytes )
177
- and feature_view .entities [0 ] == "fs1_my_entity_1"
178
- )
179
-
180
- test_feature_store .delete_feature_view ("my_feature_view_1" )
181
- feature_views = test_feature_store .list_feature_views ()
182
- assert len (feature_views ) == 0
183
-
184
- test_feature_store .teardown ()
185
-
186
-
187
71
@pytest .fixture
188
72
def feature_store_with_local_registry ():
189
73
fd , registry_path = mkstemp ()
@@ -199,44 +83,3 @@ def feature_store_with_local_registry():
199
83
)
200
84
201
85
202
- @pytest .fixture
203
- def feature_store_with_gcs_registry ():
204
- from google .cloud import storage
205
-
206
- storage_client = storage .Client ()
207
- bucket_name = f"feast-registry-test-{ int (time .time () * 1000 )} "
208
- bucket = storage_client .bucket (bucket_name )
209
- bucket = storage_client .create_bucket (bucket )
210
- bucket .add_lifecycle_delete_rule (
211
- age = 14
212
- ) # delete buckets automatically after 14 days
213
- bucket .patch ()
214
- bucket .blob ("registry.db" )
215
-
216
- return FeatureStore (
217
- config = RepoConfig (
218
- registry = f"gs://{ bucket_name } /registry.db" ,
219
- project = "default" ,
220
- provider = "gcp" ,
221
- entity_key_serialization_version = 2 ,
222
- )
223
- )
224
-
225
-
226
- @pytest .fixture
227
- def feature_store_with_s3_registry ():
228
- aws_registry_path = os .getenv (
229
- "AWS_REGISTRY_PATH" , "s3://feast-int-bucket/registries"
230
- )
231
- return FeatureStore (
232
- config = RepoConfig (
233
- registry = f"{ aws_registry_path } /{ int (time .time () * 1000 )} /registry.db" ,
234
- project = "default" ,
235
- provider = "aws" ,
236
- online_store = DynamoDBOnlineStoreConfig (
237
- region = os .getenv ("AWS_REGION" , "us-west-2" )
238
- ),
239
- offline_store = FileOfflineStoreConfig (),
240
- entity_key_serialization_version = 2 ,
241
- )
242
- )
0 commit comments