Skip to content

Commit e54ea6e

Browse files
committed
Switch entity values for all tests using push sources to not affect other tests
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
1 parent b75883a commit e54ea6e

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

sdk/python/tests/integration/e2e/test_python_feature_server.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,16 @@ def test_get_online_features(python_fs_client):
6363
@pytest.mark.integration
6464
@pytest.mark.universal_online_stores
6565
def test_push(python_fs_client):
66-
initial_temp = get_temperatures(python_fs_client, location_ids=[1])[0]
66+
# TODO(felixwang9817): Note that we choose an entity value of 102 here since it is not included
67+
# in the existing range of entity values (1-49). This allows us to push data for this test
68+
# without affecting other tests. This decision is tech debt, and should be resolved by finding a
69+
# better way to isolate data sources across tests.
6770
json_data = json.dumps(
6871
{
6972
"push_source_name": "location_stats_push_source",
7073
"df": {
71-
"location_id": [1],
72-
"temperature": [initial_temp * 100],
74+
"location_id": [102],
75+
"temperature": [4],
7376
"event_timestamp": [str(datetime.utcnow())],
7477
"created": [str(datetime.utcnow())],
7578
},
@@ -79,7 +82,7 @@ def test_push(python_fs_client):
7982

8083
# Check new pushed temperature is fetched
8184
assert response.status_code == 200
82-
assert get_temperatures(python_fs_client, location_ids=[1]) == [initial_temp * 100]
85+
assert get_temperatures(python_fs_client, location_ids=[102]) == [4]
8386

8487

8588
def get_temperatures(client, location_ids: List[int]):

sdk/python/tests/integration/offline_store/test_push_offline_retrieval.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,21 @@ def test_push_features_and_read_from_offline_store(environment, universal_data_s
2626
now = pd.Timestamp(datetime.datetime.utcnow()).round("ms")
2727

2828
store.apply([driver(), customer(), location(), *feature_views.values()])
29-
entity_df = pd.DataFrame.from_dict({"location_id": [1], "event_timestamp": [now]})
29+
entity_df = pd.DataFrame.from_dict({"location_id": [100], "event_timestamp": [now]})
3030

3131
before_df = store.get_historical_features(
3232
entity_df=entity_df,
3333
features=["pushable_location_stats:temperature"],
3434
full_feature_names=False,
3535
).to_df()
3636

37+
# TODO(felixwang9817): Note that we choose an entity value of 100 here since it is not included
38+
# in the existing range of entity values (1-49). This allows us to push data for this test
39+
# without affecting other tests. This decision is tech debt, and should be resolved by finding a
40+
# better way to isolate data sources across tests.
3741
data = {
3842
"event_timestamp": [now],
39-
"location_id": [1],
43+
"location_id": [100],
4044
"temperature": [4],
4145
"created": [now],
4246
}

sdk/python/tests/integration/online_store/test_push_online_retrieval.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ def test_push_features_and_read(environment, universal_data_sources):
2222
feature_views = construct_universal_feature_views(data_sources)
2323

2424
store.apply([driver(), customer(), location(), *feature_views.values()])
25+
26+
# TODO(felixwang9817): Note that we choose an entity value of 101 here since it is not included
27+
# in the existing range of entity values (1-49). This allows us to push data for this test
28+
# without affecting other tests. This decision is tech debt, and should be resolved by finding a
29+
# better way to isolate data sources across tests.
2530
data = {
26-
"location_id": [1],
31+
"location_id": [101],
2732
"temperature": [4],
2833
"event_timestamp": [pd.Timestamp(datetime.datetime.utcnow()).round("ms")],
2934
"created": [pd.Timestamp(datetime.datetime.utcnow()).round("ms")],
@@ -34,8 +39,8 @@ def test_push_features_and_read(environment, universal_data_sources):
3439

3540
online_resp = store.get_online_features(
3641
features=["pushable_location_stats:temperature"],
37-
entity_rows=[{"location_id": 1}],
42+
entity_rows=[{"location_id": 101}],
3843
)
3944
online_resp_dict = online_resp.to_dict()
40-
assert online_resp_dict["location_id"] == [1]
45+
assert online_resp_dict["location_id"] == [101]
4146
assert online_resp_dict["temperature"] == [4]

0 commit comments

Comments
 (0)