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

Ops-side Tests Clear DB Tables: Removes Resources Loaded by Default #2016

Closed
pattisdr opened this issue Dec 9, 2022 · 0 comments
Closed
Labels
bug Something isn't working Unified Fides

Comments

@pattisdr
Copy link
Contributor

pattisdr commented Dec 9, 2022

Bug Description

Ops tests can't rely on resources that are automatically added to the database by the application on startup because the database is intentionally wiped before the tests run.

We have a handy clear_db_tables "autouse" fixture that wipes the database in between tests to prevent any resources created by tests from sticking around. However, now that ops and ctl code have merged, there are several additional resources that are automatically added to the db on startup in load_default_resources: load_default_organization, load_default_taxonomy, and load_default_dsr_policies.

This came up here: https://github.com/ethyca/fides/pull/2009/files#r1044804685

I was adjusting data category validation on the ops-side to compare against data categories in the database instead of the static default taxonomy list. But in tests, there are no data categories in the database ops-side.

Steps to Reproduce

  1. Bring the shell up. Verify ctl_data_categories table is populated
  2. Run a test in pytest - verify the ctl_data_categories table gets wiped.

Expected behavior

It would be useful if these resources were not removed - or if they were, then we re-ran load_default_resources. Removing this fixture altogether does cause several tests to fail where we're not cleaning up resources in tests.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

  • Version:
  • OS:
  • Python Version:
  • Docker Version:

Additional context

Add any other context about the problem here.

@pattisdr pattisdr added bug Something isn't working Unified Fides labels Dec 9, 2022
@pattisdr pattisdr changed the title Ops-side Tests Clear DB Tables Removes Resources Loaded by Default Ops-side Tests Clear DB Tables: Removes Resources Loaded by Default Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Unified Fides
Projects
None yet
Development

No branches or pull requests

2 participants