Adding or reusing tests
Overview
This guide will go over:
how Feast tests are setup
how to extend the test suite to test new functionality
how to use the existing test suite to test a new custom offline / online store.
Test suite overview
Let's inspect the test setup as is:
feature_repos
has setup files for most tests in the test suite and sets up pytest fixtures for other tests. Crucially, this parametrizes on different offline stores, different online stores, etc and abstracts away store specific implementations so tests don't need to rewrite e.g. uploading dataframes to a specific store for setup.
Understanding an example test
Let's look at a sample test using the universal repo:
The key fixtures are the environment
and universal_data_sources
fixtures, which are defined in the feature_repos
directories. This by default pulls in a standard dataset with driver and customer entities, certain feature views, and feature values. By including the environment as a parameter, the test automatically parametrizes across other offline / online store combinations.
Writing a new test or reusing existing tests
To:
Include a new offline store:
extend
data_source_creator.py
for your offline storein
repo_configuration.py
add a newIntegrationTestRepoConfig
or two (depending on how many online stores you want to test)Run the full test suite with
make test-python-integration
See more guidelines at https://github.com/feast-dev/feast/issues/1892
Include a new online store:
in
repo_configuration.py
add a new config that maps to a serialized version of configuration you need infeature_store.yaml
to setup the online store.in
repo_configuration.py
, add newIntegrationTestRepoConfig
for offline stores you want to testRun the full test suite with
make test-python-integration
See more guidelines at https://github.com/feast-dev/feast/issues/1892
Add a new test to an existing test file:
Use the same function signatures as an existing test (e.g. have environment as an argument) to include the relevant test fixtures.
We prefer to expand what an individual test covers due to the cost of standing up offline / online stores
Using custom data in a new test:
This is used in several places such as
test_universal_types.py
Last updated