Skip to content

Commit 5dd68a8

Browse files
authored
Cleanup e2e and docker-compose tests (#1035)
Signed-off-by: Terence <terencelimxp@gmail.com>
1 parent 25b796f commit 5dd68a8

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

core/src/main/java/feast/core/validators/Matchers.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
public class Matchers {
2424

2525
private static Pattern BIGQUERY_TABLE_REF_REGEX =
26-
Pattern.compile("[a-zA-Z0-9-]+[:]+[a-zA-Z0-9]+[.]+[a-zA-Z0-9_]*");
26+
Pattern.compile("[a-zA-Z0-9-]+[:]+[a-zA-Z0-9_]+[.]+[a-zA-Z0-9_]*");
2727
private static Pattern UPPER_SNAKE_CASE_REGEX = Pattern.compile("^[A-Z0-9]+(_[A-Z0-9]+)*$");
2828
private static Pattern LOWER_SNAKE_CASE_REGEX = Pattern.compile("^[a-z0-9]+(_[a-z0-9]+)*$");
2929
private static Pattern VALID_CHARACTERS_REGEX = Pattern.compile("^[a-zA-Z_][a-zA-Z0-9_]*$");

infra/scripts/test-docker-compose.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ export FEAST_ONLINE_SERVING_CONTAINER_IP_ADDRESS=$(docker inspect -f '{{range .N
6363
${PROJECT_ROOT_DIR}/infra/scripts/wait-for-it.sh ${FEAST_ONLINE_SERVING_CONTAINER_IP_ADDRESS}:6566 --timeout=120
6464

6565
# Run e2e tests for Redis
66-
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'
66+
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'

sdk/python/feast/feature.py

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ def __eq__(self, other):
4646
return False
4747
return True
4848

49+
def __lt__(self, other):
50+
return self.name < other.name
51+
4952
@property
5053
def name(self):
5154
"""

sdk/python/feast/feature_table.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def __eq__(self, other):
8080
):
8181
return False
8282

83-
if self.entities != other.entities:
83+
if sorted(self.entities) != sorted(other.entities):
8484
return False
85-
if self.features != other.features:
85+
if sorted(self.features) != sorted(other.features):
8686
return False
8787
if self.batch_source != other.batch_source:
8888
return False

tests/e2e/test-register.py

+24-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import time
32
import uuid
43
from datetime import datetime
54

@@ -16,6 +15,7 @@
1615
from feast.feature import Feature
1716
from feast.feature_table import FeatureTable
1817
from feast.value_type import ValueType
18+
from feast.wait import wait_retry_backoff
1919

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

238238

239+
@pytest.mark.bq
239240
def test_ingest(
240241
client: Client,
241242
customer_entity: Entity,
@@ -255,12 +256,31 @@ def test_ingest(
255256
client.apply_feature_table(bq_featuretable)
256257
client.ingest(bq_featuretable, bq_dataset, timeout=120)
257258

258-
# Give time to allow data to propagate to BQ table
259-
time.sleep(15)
260-
259+
from google.api_core.exceptions import NotFound
261260
from google.cloud import bigquery
262261

263262
bq_client = bigquery.Client(project=gcp_project)
263+
264+
# Poll BQ for table until the table has been created
265+
def try_get_table():
266+
table_exist = False
267+
table_resp = None
268+
try:
269+
table_resp = bq_client.get_table(bq_table_id)
270+
271+
if table_resp and table_resp.table_id == bq_table_id.split(".")[-1]:
272+
table_exist = True
273+
except NotFound:
274+
pass
275+
276+
return table_resp, table_exist
277+
278+
wait_retry_backoff(
279+
retry_fn=try_get_table,
280+
timeout_secs=30,
281+
timeout_msg="Timed out trying to get bigquery table",
282+
)
283+
264284
query_string = f"SELECT * FROM `{bq_table_id}`"
265285

266286
job = bq_client.query(query_string)

0 commit comments

Comments
 (0)