Skip to content
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

Cleanup e2e and docker-compose tests #1035

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/java/feast/core/validators/Matchers.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
public class Matchers {

private static Pattern BIGQUERY_TABLE_REF_REGEX =
Pattern.compile("[a-zA-Z0-9-]+[:]+[a-zA-Z0-9]+[.]+[a-zA-Z0-9_]*");
Pattern.compile("[a-zA-Z0-9-]+[:]+[a-zA-Z0-9_]+[.]+[a-zA-Z0-9_]*");
private static Pattern UPPER_SNAKE_CASE_REGEX = Pattern.compile("^[A-Z0-9]+(_[A-Z0-9]+)*$");
private static Pattern LOWER_SNAKE_CASE_REGEX = Pattern.compile("^[a-z0-9]+(_[a-z0-9]+)*$");
private static Pattern VALID_CHARACTERS_REGEX = Pattern.compile("^[a-zA-Z_][a-zA-Z0-9_]*$");
Expand Down
2 changes: 1 addition & 1 deletion infra/scripts/test-docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ export FEAST_ONLINE_SERVING_CONTAINER_IP_ADDRESS=$(docker inspect -f '{{range .N
${PROJECT_ROOT_DIR}/infra/scripts/wait-for-it.sh ${FEAST_ONLINE_SERVING_CONTAINER_IP_ADDRESS}:6566 --timeout=120

# Run e2e tests for Redis
docker exec feast_jupyter_1 bash -c 'cd /feast/tests/e2e && pytest *.py --core_url core:6565 --serving_url=online_serving:6566 --kafka_brokers=kafka:9092'
docker exec feast_jupyter_1 bash -c 'cd /feast/tests/e2e && pytest *.py -m "not bq" --core_url core:6565 --serving_url=online_serving:6566 --kafka_brokers=kafka:9092'
3 changes: 3 additions & 0 deletions sdk/python/feast/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def __eq__(self, other):
return False
return True

def __lt__(self, other):
return self.name < other.name

@property
def name(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions sdk/python/feast/feature_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def __eq__(self, other):
):
return False

if self.entities != other.entities:
if sorted(self.entities) != sorted(other.entities):
return False
if self.features != other.features:
if sorted(self.features) != sorted(other.features):
return False
if self.batch_source != other.batch_source:
return False
Expand Down
28 changes: 24 additions & 4 deletions tests/e2e/test-register.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import time
import uuid
from datetime import datetime

Expand All @@ -16,6 +15,7 @@
from feast.feature import Feature
from feast.feature_table import FeatureTable
from feast.value_type import ValueType
from feast.wait import wait_retry_backoff

DIR_PATH = os.path.dirname(os.path.realpath(__file__))
PROJECT_NAME = "basic_" + uuid.uuid4().hex.upper()[0:6]
Expand Down Expand Up @@ -236,6 +236,7 @@ def test_get_list_alltypes(
assert actual_list_feature_table == alltypes_featuretable


@pytest.mark.bq
def test_ingest(
client: Client,
customer_entity: Entity,
Expand All @@ -255,12 +256,31 @@ def test_ingest(
client.apply_feature_table(bq_featuretable)
client.ingest(bq_featuretable, bq_dataset, timeout=120)

# Give time to allow data to propagate to BQ table
time.sleep(15)

from google.api_core.exceptions import NotFound
from google.cloud import bigquery

bq_client = bigquery.Client(project=gcp_project)

# Poll BQ for table until the table has been created
def try_get_table():
table_exist = False
table_resp = None
try:
table_resp = bq_client.get_table(bq_table_id)

if table_resp and table_resp.table_id == bq_table_id.split(".")[-1]:
table_exist = True
except NotFound:
pass

return table_resp, table_exist

wait_retry_backoff(
retry_fn=try_get_table,
timeout_secs=30,
timeout_msg="Timed out trying to get bigquery table",
)

query_string = f"SELECT * FROM `{bq_table_id}`"

job = bq_client.query(query_string)
Expand Down