Пример #1
0
 def test_read_from_yaml(self):
     feature_group = FeatureGroup.from_yaml(
         "tests/sample/valid_feature_group.yaml")
     assert feature_group.id == "my_fg"
     assert feature_group.serving_store.id == "REDIS1"
     assert feature_group.warehouse_store.id == "BIGQUERY1"
     assert feature_group.tags == ["tag1", "tag2"]
Пример #2
0
    def test_apply_multiple(self, client, mocker):
        my_storage = Storage(id="TEST", type="redis")
        my_feature_group = FeatureGroup(id="test")
        my_entity = Entity(name="test")

        grpc_stub = core.CoreServiceStub(grpc.insecure_channel(""))

        mocker.patch.object(
            grpc_stub,
            'ApplyStorage',
            return_value=CoreServiceTypes.ApplyStorageResponse(
                storageId="TEST"))
        mocker.patch.object(
            grpc_stub,
            'ApplyFeatureGroup',
            return_value=CoreServiceTypes.ApplyFeatureGroupResponse(
                featureGroupId="test"))
        mocker.patch.object(
            grpc_stub,
            'ApplyEntity',
            return_value=CoreServiceTypes.ApplyEntityResponse(
                entityName="test"))

        client._core_service_stub = grpc_stub
        ids = client.apply([my_storage, my_entity, my_feature_group])
        assert ids == ["TEST", "test", "test"]
Пример #3
0
    def test_apply_single_feature_group(self, client, mocker):
        my_feature_group = FeatureGroup(id="test")
        grpc_stub = core.CoreServiceStub(grpc.insecure_channel(""))

        with mocker.patch.object(grpc_stub, 'ApplyFeatureGroup',
                                 return_value=CoreServiceTypes.ApplyFeatureGroupResponse(
                                     featureGroupId="test")):
            client._core_service_stub = grpc_stub
            name = client.apply(my_feature_group)
            assert name == "test"
Пример #4
0
 def test_read_from_yaml(self):
     feature_group = FeatureGroup.from_yaml(
         "tests/sample/valid_feature_group.yaml")
     assert feature_group.id == "my_fg"
     assert feature_group.tags == ["tag1", "tag2"]