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

HJ-131 Delete monitors before deleting integration #5478

Merged
merged 5 commits into from
Nov 12, 2024
Merged

HJ-131 Delete monitors before deleting integration #5478

merged 5 commits into from
Nov 12, 2024

Conversation

erosselli
Copy link
Contributor

@erosselli erosselli commented Nov 7, 2024

Closes HJ-131

Description Of Changes

Before, trying to delete an integration (i.e ConnectionConfig) that had a related monitor (i.e MonitorConfig) would throw a 500 error. Intended behavior is to cascade the deletion so that all monitors associated to the given ConnectionConfig are deleted.

Code Changes

  • Updated ConnectionConfig model to explicitly define its monitors reference, and updated the class' delete method to iterate over its related MonitorConfigs and delete them as well
  • Added a test for this case
  • Created a detection_discovery_fixtures.py file to organize D&D fixtures in one single place

Steps to Confirm

  1. Pull down this fidesplus branch so that you have all D&D features.
  2. Create an integration, or click on an existing one, e.g a BigQuery integration.
  3. Add a couple (i.e more than 1) monitors to the integration
  4. Click Delete integration
  5. Integration and monitors should both be deleted

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
  • Followup issues:
    • Followup issues created (include link)
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

Copy link

vercel bot commented Nov 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 2:58pm

Copy link

cypress bot commented Nov 7, 2024

fides    Run #10940

Run Properties:  status check passed Passed #10940  •  git commit d9b2e1f26b ℹ️: Merge c4246efd4203e5c96437d8e09a932901fb5c522e into ea84dc29bfd1b5e51b41995a9ec4...
Project fides
Branch Review refs/pull/5478/merge
Run status status check passed Passed #10940
Run duration 00m 39s
Commit git commit d9b2e1f26b ℹ️: Merge c4246efd4203e5c96437d8e09a932901fb5c522e into ea84dc29bfd1b5e51b41995a9ec4...
Committer erosselli
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

Comment on lines -193 to -194
@pytest.fixture
def create_monitor_config(self, db: Session, connection_config: ConnectionConfig):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved this fixture to the new detection_discovery_fixtures.py file I created and just renamed it to monitor_config, to be more consistent with our existing fixture names

Comment on lines +25 to +27
if TYPE_CHECKING:
from fides.api.models.detection_discovery import MonitorConfig

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 is so mypy doesn't complain about not recognizing the MonitorConfig model. The if TYPE_CHECKING is needed to avoid a circular import

@erosselli erosselli changed the title [WIP] Delete monitors before deleting integration HJ-131 Delete monitors before deleting integration Nov 11, 2024
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.20%. Comparing base (ea84dc2) to head (c4246ef).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/fides/api/models/connectionconfig.py 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5478      +/-   ##
==========================================
- Coverage   85.20%   85.20%   -0.01%     
==========================================
  Files         386      386              
  Lines       24234    24242       +8     
  Branches     2640     2642       +2     
==========================================
+ Hits        20649    20655       +6     
- Misses       3032     3033       +1     
- Partials      553      554       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@erosselli erosselli marked this pull request as ready for review November 11, 2024 20:00
@erosselli erosselli merged commit f602552 into main Nov 12, 2024
38 of 39 checks passed
@erosselli erosselli deleted the HJ-131 branch November 12, 2024 15:29
Copy link

cypress bot commented Nov 12, 2024

fides    Run #10942

Run Properties:  status check passed Passed #10942  •  git commit f6025520c1: HJ-131 Delete monitors before deleting integration (#5478)
Project fides
Branch Review main
Run status status check passed Passed #10942
Run duration 00m 37s
Commit git commit f6025520c1: HJ-131 Delete monitors before deleting integration (#5478)
Committer erosselli
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants