You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/how-to-guides/adding-or-reusing-tests.md
+28-20Lines changed: 28 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ This guide will go over:
10
10
11
11
## Test suite overview
12
12
13
-
Let's inspect the test setup as is:
13
+
Let's inspect the test setup in `sdk/python/tests/integration`:
14
14
15
15
```bash
16
16
$ tree
@@ -55,7 +55,7 @@ $ tree
55
55
8 directories, 27 files
56
56
```
57
57
58
-
`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.
58
+
`feature_repos` has setup files for most tests in the test suite and pytest fixtures for other tests. These fixtures parametrize on different offline stores, online stores, etc. and thus abstract away store specific implementations so tests don't need to rewrite e.g. uploading dataframes to a specific store for setup.
59
59
60
60
## Understanding an example test
61
61
@@ -148,26 +148,34 @@ The key fixtures are the `environment` and `universal_data_sources` fixtures, wh
148
148
149
149
## Writing a new test or reusing existing tests
150
150
151
-
To:
152
-
153
-
* Include a new offline store: 
154
-
* extend `data_source_creator.py` for your offline store
155
-
* in `repo_configuration.py` add a new`IntegrationTestRepoConfig` or two (depending on how many online stores you want to test)
156
-
* Run the full test suite with `make test-python-integration`
157
-
* See more guidelines at [https://github.com/feast-dev/feast/issues/1892](https://github.com/feast-dev/feast/issues/1892)
158
-
* Include a new online store:
159
-
* in `repo_configuration.py` add a new config that maps to a serialized version of configuration you need in `feature_store.yaml` to setup the online store.
160
-
* in `repo_configuration.py`, add new`IntegrationTestRepoConfig` for offline stores you want to test
161
-
* Run the full test suite with `make test-python-integration`
162
-
* See more guidelines at [https://github.com/feast-dev/feast/issues/1892](https://github.com/feast-dev/feast/issues/1892)
163
-
* Add a new test to an existing test file:
164
-
* Use the same function signatures as an existing test (e.g. have environment as an argument) to include the relevant test fixtures. 
165
-
* We prefer to expand what an individual test covers due to the cost of standing up offline / online stores
166
-
* Using custom data in a new test:
167
-
* This is used in several places such as `test_universal_types.py` 
151
+
To add a new test to an existing test file:
168
152
169
-
```python
153
+
* Use the same function signatures as an existing test (e.g. use `environment` as an argument) to include the relevant test fixtures.
154
+
* If possible, expand an individual test instead of writing a new test, due to the cost of standing up offline / online stores.
155
+
156
+
To test a new offline / online store from a plugin repo:
157
+
158
+
* Install Feast in editable mode with `pip install -e`.
159
+
* The core tests for offline / online store behavior are parametrized by the `FULL_REPO_CONFIGS` variable 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 `IntegrationTestRepoConfig` or two) and set the environment variable `FULL_REPO_CONFIGS_MODULE` to point to that file. Then the core offline / online store tests can be run with `make test-python-universal`.
160
+
* See the [custom offline store demo](https://github.com/feast-dev/feast-custom-offline-store-demo) and the [custom online store demo](https://github.com/feast-dev/feast-custom-online-store-demo) for examples.
161
+
162
+
To include a new offline / online store in the main Feast repo:
163
+
164
+
* Extend `data_source_creator.py` for your offline store.
165
+
* In `repo_configuration.py` add a new`IntegrationTestRepoConfig` or two (depending on how many online stores you want to test).
166
+
* Run the full test suite with `make test-python-integration.`
170
167
168
+
To include a new online store:
169
+
170
+
* In `repo_configuration.py` add a new config that maps to a serialized version of configuration you need in `feature_store.yaml` to setup the online store.
171
+
* In `repo_configuration.py`, add new`IntegrationTestRepoConfig` for offline stores you want to test.
172
+
* Run the full test suite with `make test-python-integration`
173
+
174
+
To use custom data in a new test:
175
+
176
+
* Check `test_universal_types.py` for an example of how to do this.
0 commit comments