Skip to content

Commit 9359441

Browse files
felixwang9817gitbook-bot
authored andcommitted
GitBook: [#315] Plugin test docs
1 parent 7538f7e commit 9359441

1 file changed

Lines changed: 28 additions & 20 deletions

File tree

docs/how-to-guides/adding-or-reusing-tests.md

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This guide will go over:
1010

1111
## Test suite overview
1212

13-
Let's inspect the test setup as is:
13+
Let's inspect the test setup in `sdk/python/tests/integration`:
1414

1515
```bash
1616
$ tree
@@ -55,7 +55,7 @@ $ tree
5555
8 directories, 27 files
5656
```
5757

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.
5959

6060
## Understanding an example test
6161

@@ -148,26 +148,34 @@ The key fixtures are the `environment` and `universal_data_sources` fixtures, wh
148148

149149
## Writing a new test or reusing existing tests
150150

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:
168152

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.`
170167

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.
177+
178+
```python
171179
@pytest.mark.integration
172180
def your_test(environment: Environment):
173181
df = #...#

0 commit comments

Comments
 (0)