Skip to content

Commit

Permalink
[Unified Fides] Address Remaining Failing Fidesops-Related Test Failu…
Browse files Browse the repository at this point in the history
…res (#1178)

* Delete fidesctl user routes in favor of fidesops user routes.

They are practically copies of each other except fidesops user logout route has improved logic such as allowing the user to logout with a malformed or expired token.  The fidesctl route was taking priority.

* Use new CONFIG variable in test_saas_queryconfig

* Adjust fidesops health endpoint test.  We're using the fidesctl health endpoint now and they surface a version number while fidesops did not.

* Add missing CONFIG variable in existing execution tests.

Fix incorrect timescale test name.

* Add missing timescale secrets to integration_test_config.toml.
  • Loading branch information
pattisdr authored Oct 3, 2022
1 parent 2a8b8f6 commit 56eda03
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 129 deletions.
2 changes: 1 addition & 1 deletion src/fides/api/ctl/routes/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_cache_health() -> str:
},
)
async def health() -> Dict:
"Confirm that the API is running and healthy."
"""Confirm that the API is running and healthy."""
database_health = get_db_health(CONFIG.database.sync_database_uri)
cache_health = get_cache_health()
response = {
Expand Down
111 changes: 0 additions & 111 deletions src/fides/api/ctl/routes/user.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/fides/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
datamap,
generate,
health,
user,
validate,
visualize,
)
Expand Down Expand Up @@ -82,7 +81,6 @@
datamap.router,
generate.router,
health.router,
user.router,
validate.router,
view.router,
]
Expand Down
11 changes: 6 additions & 5 deletions tests/ops/api/v1/endpoints/test_health_endpoints.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from starlette.testclient import TestClient

import fides
from fides.api.ops.api.v1.urn_registry import HEALTH


def test_health(api_client: TestClient) -> None:
response = api_client.get(HEALTH)
assert response.json() == {
"webserver": "healthy",
"database": "healthy",
"cache": "healthy",
}
json = response.json()
assert json["webserver"] == "healthy"
assert json["database"] == "healthy"
assert json["cache"] == "healthy"
assert json["version"] == str(fides.__version__)
7 changes: 7 additions & 0 deletions tests/ops/integration_test_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@ user="mariadb_user"
password="mariadb_pw"
db="mariadb_example"
port=3306

[timescale_example]
server="timescale_example"
user="postgres"
password="postgres"
db="timescale_example"
port=5432
6 changes: 4 additions & 2 deletions tests/ops/integration_tests/test_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
get_privacy_request_results,
)

CONFIG = get_config()


def get_sorted_execution_logs(db, privacy_request: PrivacyRequest):
return [
Expand Down Expand Up @@ -134,7 +136,7 @@ def delete_connection_config(_):
Delete the mongo connection in a separate session, for testing purposes, while the privacy request
is in progress. Arbitrarily hooks into the log_start method to do this.
"""
SessionLocal = get_db_session(config)
SessionLocal = get_db_session(CONFIG)
new_session = SessionLocal()
try:
reloaded_config = new_session.query(ConnectionConfig).get(
Expand Down Expand Up @@ -405,7 +407,7 @@ def disable_connection_config(_):
in a new session, to mimic the ConnectionConfig being disabled by a separate request while request
is in progress.
"""
SessionLocal = get_db_session(config)
SessionLocal = get_db_session(CONFIG)
new_session = SessionLocal()
reloaded_config = new_session.query(ConnectionConfig).get(
mongo_connection_config.id
Expand Down
16 changes: 9 additions & 7 deletions tests/ops/integration_tests/test_sql_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
str_converter,
)

CONFIG = get_config()

logger = logging.getLogger(__name__)
sample_postgres_configuration_policy = erasure_policy(
"system.operations",
Expand Down Expand Up @@ -1060,9 +1062,9 @@ async def test_retry_access_request(
policy,
integration_postgres_config,
):
config.execution.task_retry_count = 1
config.execution.task_retry_delay = 0.1
config.execution.task_retry_backoff = 0.01
CONFIG.execution.task_retry_count = 1
CONFIG.execution.task_retry_delay = 0.1
CONFIG.execution.task_retry_backoff = 0.01

dataset = FidesopsDataset(**example_datasets[0])
graph = convert_dataset_to_graph(dataset, integration_postgres_config.key)
Expand Down Expand Up @@ -1113,9 +1115,9 @@ async def test_retry_erasure(
policy,
integration_postgres_config,
):
config.execution.task_retry_count = 2
config.execution.task_retry_delay = 0.1
config.execution.task_retry_backoff = 0.01
CONFIG.execution.task_retry_count = 2
CONFIG.execution.task_retry_delay = 0.1
CONFIG.execution.task_retry_backoff = 0.01

dataset = FidesopsDataset(**example_datasets[0])
graph = convert_dataset_to_graph(dataset, integration_postgres_config.key)
Expand Down Expand Up @@ -1172,7 +1174,7 @@ async def test_retry_erasure(
@pytest.mark.integration_timescale
@pytest.mark.integration
@pytest.mark.asyncio
async def test_postgres_access_request_task(
async def test_timescale_access_request_task(
db,
policy,
timescale_connection_config,
Expand Down
2 changes: 1 addition & 1 deletion tests/ops/service/connectors/test_saas_queryconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def test_get_masking_request(
method="DELETE", path="/api/0/<conversation>/<conversation_id>/"
)
# Delete endpoint not used because masking_strict is True
assert config.execution.masking_strict is True
assert CONFIG.execution.masking_strict is True

query_config = SaaSQueryConfig(conversations, endpoints, {})
saas_request = query_config.get_masking_request()
Expand Down

0 comments on commit 56eda03

Please sign in to comment.