-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Generate environments for each individual test based on its markers/fixtures #2648
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2648 +/- ##
===========================================
- Coverage 80.55% 58.89% -21.66%
===========================================
Files 163 164 +1
Lines 13815 13761 -54
===========================================
- Hits 11128 8105 -3023
- Misses 2687 5656 +2969
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
134251c
to
b58c052
Compare
@@ -78,7 +78,7 @@ func (b *MemoryBuffer) getArrowSchema() (*arrow.Schema, error) { | |||
fields = append(fields, arrow.Field{Name: featureName, Type: arrowType}) | |||
fields = append(fields, arrow.Field{ | |||
Name: fmt.Sprintf("%s__timestamp", featureName), | |||
Type: arrow.FixedWidthTypes.Timestamp_s}) | |||
Type: arrow.FixedWidthTypes.Timestamp_ms}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this should in a separate PR, unless it's fixing some bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reverted
|
||
AVAILABLE_OFFLINE_STORES = [("local", PostgreSQLDataSourceCreator)] | ||
|
||
AVAILABLE_ONLINE_STORES = {"postgres": (POSTGRES_ONLINE_CONFIG, None)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use the AVAILABLE_OFFLINE_STORES
here as well? POSTGRES_ONLINE_CONFIG
assumes you have a local version of postgres running and a containerized version is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
if "universal_offline_stores" in markers: | ||
offline_stores = AVAILABLE_OFFLINE_STORES | ||
else: | ||
# default offline store for testing online store dimension | ||
offline_stores = [("local", FileDataSourceCreator)] | ||
|
||
online_stores = None | ||
if "universal_online_stores" in markers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we get rid of the universal
flag? since it doesn't seem like the online and offline versions are more versatile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I need a name here that would represent that specific tests works with all offline stores (universal_offline_stores
mark currently) or all online stores (universal_online_stores
mark). Any ideas for a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the pytest.mark.universal
flag (since it seems like this the universal_online_stores
and universal_offline_stores
together would represent the same thing that current flag is supposed to represent).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Removed universal
.
@@ -8,63 +8,48 @@ | |||
import pyarrow as pa | |||
import pytest | |||
|
|||
from feast import Entity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, from feast.entity import Entity
(for tests)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
POSTGRES_ONLINE_CONFIG = { | ||
"type": "postgres", | ||
"host": "localhost", | ||
"port": "5432", | ||
"database": "postgres", | ||
"db_schema": "feature_store", | ||
"user": "postgres", | ||
"password": "docker", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My PR changes this, #2650
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted
Signed-off-by: Oleksii Moskalenko <moskalenko.alexey@gmail.com>
query = client.query(kind="Row", ancestor=key) | ||
while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
infinite looping here might hang the whole testing flow
sdk/python/tests/conftest.py
Outdated
_config_cache = {} | ||
|
||
|
||
def pytest_generate_tests(metafunc): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some docs to how this pytest_generate_tests
thingy works? It's the first time I've seen it used and seems extremely powerful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comment.
if "universal_offline_stores" in markers: | ||
offline_stores = AVAILABLE_OFFLINE_STORES | ||
else: | ||
# default offline store for testing online store dimension | ||
offline_stores = [("local", FileDataSourceCreator)] | ||
|
||
online_stores = None | ||
if "universal_online_stores" in markers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the pytest.mark.universal
flag (since it seems like this the universal_online_stores
and universal_offline_stores
together would represent the same thing that current flag is supposed to represent).
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: achals, pyalex The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Oleksii Moskalenko <moskalenko.alexey@gmail.com>
/lgtm Thanks for addressing! This looks great. |
Signed-off-by: Oleksii Moskalenko moskalenko.alexey@gmail.com
What this PR does / why we need it:
Test environment is being generated individually for each integration test based on its markers and/or requested fixtures. This allows us to drop some unnecessary use cases (eg, looping various online stores against test_historical_features) and shorten total run time.
The main change is
pytest_generate_tests
function inconftest.py
that replaces static declaration of repo configs. It generates environments for each test and retrieves them from configs cache, so that environments could be shared between different tests.Which issue(s) this PR fixes:
Fixes #