Skip to content

Commit 6c35d45

Browse files
chore: Refactor some unit tests into integration tests (#5820)
* chore: Refactor some unit tests into integration tests Signed-off-by: Francisco Javier Arceo <farceo@redhat.com> * chore: Refactor some unit tests into integration tests Signed-off-by: Francisco Javier Arceo <farceo@redhat.com> * rename TestConfig Signed-off-by: Francisco Javier Arceo <farceo@redhat.com> * rename TestConfig Signed-off-by: Francisco Javier Arceo <farceo@redhat.com> * add integration flag Signed-off-by: Francisco Javier Arceo <farceo@redhat.com> * update paths Signed-off-by: Francisco Javier Arceo <farceo@redhat.com> * update paths Signed-off-by: Francisco Javier Arceo <farceo@redhat.com> --------- Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
1 parent 34d9b52 commit 6c35d45

File tree

10 files changed

+81
-51
lines changed

10 files changed

+81
-51
lines changed

.github/workflows/registry-rest-api-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ jobs:
145145
- name: Setup and Run Registry Rest API tests
146146
run: |
147147
echo "Running Registry REST API tests..."
148-
cd sdk/python/tests/registry_rest_api_tests/
149-
pytest test_feast_registry.py -s
148+
cd sdk/python
149+
pytest tests/integration/registration/rest_api/test_registry_rest_api.py --integration -s
150150
151151
- name: Clean up docker images
152152
if: always()

sdk/python/tests/registry_rest_api_tests/conftest.py renamed to sdk/python/tests/integration/registration/rest_api/conftest.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import os
2+
from pathlib import Path
23

34
import pytest
45
import requests
56
from kubernetes import client, config
6-
from support import (
7+
8+
from tests.integration.registration.rest_api.support import (
79
applyFeastProject,
810
create_feast_project,
911
create_namespace,
@@ -41,6 +43,10 @@ def feast_rest_client():
4143
config.load_kube_config()
4244
api_instance = client.CoreV1Api()
4345

46+
# Get the directory containing this conftest.py file
47+
test_dir = Path(__file__).parent
48+
resource_dir = test_dir / "resource"
49+
4450
# Constants and environment values
4551
namespace = "test-ns-feast-rest"
4652
credit_scoring = "credit-scoring"
@@ -54,23 +60,37 @@ def feast_rest_client():
5460
try:
5561
if not run_on_openshift:
5662
# Deploy dependencies
57-
deploy_and_validate_pod(namespace, "resource/redis.yaml", "app=redis")
58-
deploy_and_validate_pod(namespace, "resource/postgres.yaml", "app=postgres")
63+
deploy_and_validate_pod(
64+
namespace, str(resource_dir / "redis.yaml"), "app=redis"
65+
)
66+
deploy_and_validate_pod(
67+
namespace, str(resource_dir / "postgres.yaml"), "app=postgres"
68+
)
5969

6070
# Create and validate FeatureStore CRs
6171
create_feast_project(
62-
"resource/feast_config_credit_scoring.yaml", namespace, credit_scoring
72+
str(resource_dir / "feast_config_credit_scoring.yaml"),
73+
namespace,
74+
credit_scoring,
6375
)
6476
validate_feature_store_cr_status(namespace, credit_scoring)
6577

6678
create_feast_project(
67-
"resource/feast_config_driver_ranking.yaml", namespace, driver_ranking
79+
str(resource_dir / "feast_config_driver_ranking.yaml"),
80+
namespace,
81+
driver_ranking,
6882
)
6983
validate_feature_store_cr_status(namespace, driver_ranking)
7084

7185
# Deploy ingress and get route URL
7286
run_kubectl_command(
73-
["apply", "-f", "resource/feast-registry-nginx.yaml", "-n", namespace]
87+
[
88+
"apply",
89+
"-f",
90+
str(resource_dir / "feast-registry-nginx.yaml"),
91+
"-n",
92+
namespace,
93+
]
7494
)
7595
ingress_host = run_kubectl_command(
7696
[
@@ -114,7 +134,7 @@ def feast_rest_client():
114134
aws_secret_key,
115135
aws_bucket,
116136
registry_path,
117-
"resource/feast_config_rhoai.yaml",
137+
str(resource_dir / "feast_config_rhoai.yaml"),
118138
namespace,
119139
)
120140
validate_feature_store_cr_status(namespace, "test-s3")

sdk/python/tests/registry_rest_api_tests/resource/feast-registry-nginx.yaml renamed to sdk/python/tests/integration/registration/rest_api/resource/feast-registry-nginx.yaml

File renamed without changes.

sdk/python/tests/registry_rest_api_tests/resource/feast_config_credit_scoring.yaml renamed to sdk/python/tests/integration/registration/rest_api/resource/feast_config_credit_scoring.yaml

File renamed without changes.

sdk/python/tests/registry_rest_api_tests/resource/feast_config_driver_ranking.yaml renamed to sdk/python/tests/integration/registration/rest_api/resource/feast_config_driver_ranking.yaml

File renamed without changes.

sdk/python/tests/registry_rest_api_tests/resource/feast_config_rhoai.yaml renamed to sdk/python/tests/integration/registration/rest_api/resource/feast_config_rhoai.yaml

File renamed without changes.

sdk/python/tests/registry_rest_api_tests/resource/postgres.yaml renamed to sdk/python/tests/integration/registration/rest_api/resource/postgres.yaml

File renamed without changes.

sdk/python/tests/registry_rest_api_tests/resource/redis.yaml renamed to sdk/python/tests/integration/registration/rest_api/resource/redis.yaml

File renamed without changes.

sdk/python/tests/registry_rest_api_tests/support.py renamed to sdk/python/tests/integration/registration/rest_api/support.py

File renamed without changes.

0 commit comments

Comments
 (0)