sdk/python/tests/unit. Integration tests are contained in
sdk/python/tests/integration. Let's inspect the structure of
feature_reposhas setup files for most tests in the test suite.
conftest.py(in the parent directory) contains the most common fixtures, which are designed as an abstraction on top of specific offline/online stores, so tests do not need to be rewritten for different stores. Individual test files also contain more specific fixtures.
universal_data_sources) that can be parametrized to cover various combinations of offline stores, online stores, and providers. This allows tests to run against all these various combinations without requiring excess code. The universal feature repo is constructed by fixtures in
conftest.pywith help from the various files in
universal_data_sourcesfixtures, which are defined in the
feature_reposdirectories and the
conftest.pyfile. This by default pulls in a standard dataset with driver and customer entities (that we have pre-defined), certain feature views, and feature values.
environmentfixture sets up a feature store, parametrized by the provider and the online/offline store. It allows the test to query against that feature store without needing to worry about the underlying implementation or any setup that may be involved in creating instances of these datastores.
IntegrationTestRepoConfigwhich is used by pytest to generate a unique test testing one of the different environments that require testing.
@pytest.mark.integrationmarker is used to designate integration tests which will cause the test to be run when you call
@pytest.mark.universal_offline_storesmarker will parametrize the test on all of the universal offline stores including file, redshift, bigquery and snowflake.
full_feature_namesparametrization defines whether or not the test should reference features as their full feature name (fully qualified path) or just the feature name itself.
universal_data_sourcesas an argument) to include the relevant test fixtures.
universal_online_storemarkers to parametrize the test against different offline store and online store combinations. You can also designate specific online and offline stores to test by using the
onlyparameter on the marker.
pip install -e.
FULL_REPO_CONFIGSvariable defined in
feature_repos/repo_configuration.py. To overwrite this variable without modifying the Feast repo, create your own file that contains a
FULL_REPO_CONFIGS(which will require adding a new
IntegrationTestRepoConfigor two) and set the environment variable
FULL_REPO_CONFIGS_MODULEto point to that file. Then the core offline / online store tests can be run with
inference.pyso that Feast can infer your datasource schemas
type_map.pyso that Feast knows how to convert your datastores types to Feast-recognized types in
data_source_creator.pyfor your offline store.
repo_configuration.pyadd a new
IntegrationTestRepoConfigor two (depending on how many online stores you want to test).
data_source_creator.pyfor your offline store and implement the required APIs.
contrib_repo_configuration.pyadd a new
IntegrationTestRepoConfig(depending on how many online stores you want to test).
repo_configuration.pyadd a new config that maps to a serialized version of configuration you need in
feature_store.yamlto setup the online store.
repo_configuration.py, add new
IntegrationTestRepoConfigfor online stores you want to test.
test_universal_types.pyfor an example of how to do this.
brew install redis.
redis-cli --helpshould show corresponding help menus.
./infra/scripts/redis-cluster.sh createto start the Redis cluster locally. You should see output that looks like this:
./infra/scripts/redis-cluster.sh stopand then