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

[Unified Fides Resources] Update Test Env Setup and Quickstart #2225

Merged

Conversation

pattisdr
Copy link
Contributor

@pattisdr pattisdr commented Jan 13, 2023

Closes N/A

Code Changes

  • Adjust test env setup and quickstart to call a different set of endpoints when creating datasetconfigs (upsert the ctl dataset first and then link to the datasetconfig) instead of the old endpoint (patch a datasetconfig)

Steps to Confirm

  • Run nox -s test_env
  • Verify everything came up as expected
  • nox -s clean
  • Run nox -s quickstart - run quickstart through to the end

Pre-Merge Checklist

Description Of Changes

Get tests passing on unified-fides-resources branch after update with main.

Also: Remove remaining uses of ops dataset endpoints in fides that we'd like to eventually deprecate (not a blocker for unified-fides-resources): deprecation will happen as a follow-up in the future: #2092. These endpoints still work, but are riskier because a dataset is upserted in the background, and we don't want people to unintentionally override their datasets.

  • Instead of a patch to /connection/connection_key/dataset do a post to /dataset/upsert and then a patch to /connection/connection_key/datasetconfig in both the test env setup and the quickstart

- Instead of a patch to /connection/connection_key/dataset do a post to /dataset/upsert and then a patch to /connection/connection_key/datasetconfig.
- Fix logging issue.
@pattisdr pattisdr added Unified Fides Resources run unsafe ci checks Runs fides-related CI checks that require sensitive credentials and removed run unsafe ci checks Runs fides-related CI checks that require sensitive credentials labels Jan 13, 2023
@pattisdr
Copy link
Contributor Author

pattisdr commented Jan 13, 2023

@ThomasLaPiana wanted to see if you had any ideas here. The unified-fides-resources feature branch has been consistently failing the fides_db_scan checks with:

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "fides-db" (172.18.0.3), port 5432 failed: FATAL:  database "fides_test" does not exist`.

Both Allison and I have run into this on respective PR's against unified-fides-resources. I've been updating the branch regularly with main, where it doesn't seem to be failing.

I wonder if it's related to populating the application db versus the test db.

EDIT: Nevermind Thomas, I spotted it, this branch was trying to connect to the test db not the application db after all for some reason.

@pattisdr pattisdr marked this pull request as ready for review January 13, 2023 14:40
@pattisdr pattisdr self-assigned this Jan 13, 2023
…es" should be scanning the application db not the test db.
@@ -7,7 +7,7 @@ db = "fides"
test_db = "fides_test"

[credentials]
app_postgres = {connection_string="postgresql+psycopg2://postgres:fides@fides-db:5432/fides_test"}
app_postgres = {connection_string="postgresql+psycopg2://postgres:fides@fides-db:5432/fides"}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why I made this change on this branch, that was a mistake - this should be looking at the running application db not the test db, and it was why we've had a failing test on this branch for awhile.

@@ -324,7 +344,7 @@ def create_dsr_policy(key: str):
if response.ok:
policies = (response.json())["succeeded"]
if len(policies) > 0:
logger.info("Created fidesops policy with key=%s via {url}", key)
logger.info("Created fidesops policy with key={} via {}", key, url)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This had been causing the quickstart to break FYI, not sure if people are using the quickstart

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe @seanpreston said it was still being used for manual testing. If that's the case I think we should also be running it during CI checks (another ticket for another time)

… sub categories to avoid conflict when resolving data categories.
@pattisdr
Copy link
Contributor Author

pattisdr commented Jan 17, 2023

@allisonking the main reason I put up this PR was to get relevant passing on unified-fides-resources after I got it up to date with main. It fixes that failing fides db scan issue we were both running into, and gets some of the newly added saas connectors adjusted so they work with unified-fides-resources. The remaining failing tests are unrelated to this work.

Copy link
Contributor

@allisonking allisonking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@@ -91,7 +91,6 @@ dataset:
fidesops_meta:
data_type: string
- name: shopify_customer_id
data_categories: [system.operations]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come this had to be deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, with the unified-fides-resources merge, the ops side has a constraint where you can't put data categories at the "object" level. If you have nested data, data categories need to be on the sub-fields. This is because DSR's use the data categories to figure out which fields to send to the user. If the top level field and sub field have different data categories that conflict, we could get in a state where we don't know which data we should send.

@pattisdr
Copy link
Contributor Author

Thanks for the review @allisonking

@pattisdr pattisdr merged commit 5306c2d into unified-fides-resources Jan 17, 2023
@pattisdr pattisdr deleted the unified-fides-resources-setup-and-quickstart branch January 17, 2023 15:52
@pattisdr pattisdr mentioned this pull request Jan 17, 2023
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run unsafe ci checks Runs fides-related CI checks that require sensitive credentials Unified Fides Resources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants