|
42 | 42 | _TEST_ESF_OPTIMIZED_FOS_LABELS,
|
43 | 43 | _TEST_ESF_OPTIMIZED_FOS_PATH,
|
44 | 44 | _TEST_FOS_LIST,
|
| 45 | + _TEST_FV_LIST, |
45 | 46 | _TEST_FV1_BQ_URI,
|
46 | 47 | _TEST_FV1_ENTITY_ID_COLUMNS,
|
47 | 48 | _TEST_FV1_ID,
|
48 | 49 | _TEST_FV1_LABELS,
|
49 | 50 | _TEST_FV1_PATH,
|
50 |
| - _TEST_FV3_BQ_URI, |
| 51 | + _TEST_FV2_ID, |
| 52 | + _TEST_FV2_LABELS, |
| 53 | + _TEST_FV2_PATH, |
51 | 54 | _TEST_FV3_ID,
|
52 | 55 | _TEST_FV3_LABELS,
|
53 | 56 | _TEST_FV3_PATH,
|
@@ -617,65 +620,39 @@ def test_create_rag_fv_bad_uri_raises_error(get_fos_mock):
|
617 | 620 | )
|
618 | 621 |
|
619 | 622 |
|
620 |
| -@pytest.mark.parametrize("create_request_timeout", [None, 1.0]) |
621 |
| -@pytest.mark.parametrize("sync", [True, False]) |
622 |
| -def test_create_rag_fv( |
623 |
| - create_request_timeout, |
624 |
| - sync, |
| 623 | +def test_list_feature_views( |
625 | 624 | get_fos_mock,
|
626 |
| - create_rag_fv_mock, |
627 |
| - get_rag_fv_mock, |
628 |
| - fos_logger_mock, |
| 625 | + list_fv_mock, |
629 | 626 | ):
|
630 | 627 | aiplatform.init(project=_TEST_PROJECT, location=_TEST_LOCATION)
|
631 |
| - fos = FeatureOnlineStore(_TEST_BIGTABLE_FOS1_ID) |
632 | 628 |
|
633 |
| - rag_fv = fos.create_feature_view( |
634 |
| - _TEST_FV3_ID, |
635 |
| - FeatureViewVertexRagSource(uri=_TEST_FV3_BQ_URI), |
636 |
| - labels=_TEST_FV3_LABELS, |
637 |
| - create_request_timeout=create_request_timeout, |
638 |
| - ) |
| 629 | + fos = FeatureOnlineStore(_TEST_BIGTABLE_FOS1_ID) |
| 630 | + feature_views = fos.list_feature_views() |
639 | 631 |
|
640 |
| - if not sync: |
641 |
| - fos.wait() |
| 632 | + list_fv_mock.assert_called_once_with(request={"parent": _TEST_BIGTABLE_FOS1_PATH}) |
| 633 | + assert len(feature_views) == len(_TEST_FV_LIST) |
642 | 634 |
|
643 |
| - # When creating, the FeatureView object doesn't have the path set. |
644 |
| - expected_fv = types.feature_view.FeatureView( |
645 |
| - vertex_rag_source=types.feature_view.FeatureView.VertexRagSource( |
646 |
| - uri=_TEST_FV3_BQ_URI, |
647 |
| - ), |
648 |
| - labels=_TEST_FV3_LABELS, |
| 635 | + fv_eq( |
| 636 | + feature_views[0], |
| 637 | + name=_TEST_FV1_ID, |
| 638 | + resource_name=_TEST_FV1_PATH, |
| 639 | + project=_TEST_PROJECT, |
| 640 | + location=_TEST_LOCATION, |
| 641 | + labels=_TEST_FV1_LABELS, |
649 | 642 | )
|
650 |
| - create_rag_fv_mock.assert_called_with( |
651 |
| - parent=_TEST_BIGTABLE_FOS1_PATH, |
652 |
| - feature_view=expected_fv, |
653 |
| - feature_view_id=_TEST_FV3_ID, |
654 |
| - metadata=(), |
655 |
| - timeout=create_request_timeout, |
| 643 | + fv_eq( |
| 644 | + feature_views[1], |
| 645 | + name=_TEST_FV2_ID, |
| 646 | + resource_name=_TEST_FV2_PATH, |
| 647 | + project=_TEST_PROJECT, |
| 648 | + location=_TEST_LOCATION, |
| 649 | + labels=_TEST_FV2_LABELS, |
656 | 650 | )
|
657 |
| - |
658 | 651 | fv_eq(
|
659 |
| - fv_to_check=rag_fv, |
| 652 | + feature_views[2], |
660 | 653 | name=_TEST_FV3_ID,
|
661 | 654 | resource_name=_TEST_FV3_PATH,
|
662 | 655 | project=_TEST_PROJECT,
|
663 | 656 | location=_TEST_LOCATION,
|
664 | 657 | labels=_TEST_FV3_LABELS,
|
665 | 658 | )
|
666 |
| - |
667 |
| - fos_logger_mock.assert_has_calls( |
668 |
| - [ |
669 |
| - call("Creating FeatureView"), |
670 |
| - call( |
671 |
| - f"Create FeatureView backing LRO: {create_rag_fv_mock.return_value.operation.name}" |
672 |
| - ), |
673 |
| - call( |
674 |
| - "FeatureView created. Resource name: projects/test-project/locations/us-central1/featureOnlineStores/my_fos1/featureViews/my_fv3" |
675 |
| - ), |
676 |
| - call("To use this FeatureView in another session:"), |
677 |
| - call( |
678 |
| - "feature_view = aiplatform.FeatureView('projects/test-project/locations/us-central1/featureOnlineStores/my_fos1/featureViews/my_fv3')" |
679 |
| - ), |
680 |
| - ] |
681 |
| - ) |
0 commit comments