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

Remove agents associated with deleted SS, #91. #214

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

melaniekung
Copy link
Contributor

No description provided.

@melaniekung melaniekung force-pushed the dev/91-ss-delete-rm-agents branch 3 times, most recently from 7ac9333 to cb3692f Compare September 11, 2023 21:05
@mcantelon
Copy link
Member

mcantelon commented Sep 11, 2023

This is looking good!

One thing that'd be good is adding a test to ensure that the agents get deleted when the storage service is deleted.

Something like:

diff --git a/AIPscan/Aggregator/tests/test_tasks.py b/AIPscan/Aggregator/tests/test_tasks.py
index 66791b5..cc248df 100644
--- a/AIPscan/Aggregator/tests/test_tasks.py
+++ b/AIPscan/Aggregator/tests/test_tasks.py
@@ -25,7 +25,7 @@ from AIPscan.Aggregator.tests import (
     VALID_JSON,
     MockResponse,
 )
-from AIPscan.models import AIP, FetchJob, StorageService
+from AIPscan.models import Agent, AIP, FetchJob, StorageService
 
 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
 FIXTURES_DIR = os.path.join(SCRIPT_DIR, "fixtures")
 @@ -198,6 +198,9 @@ def test_delete_fetch_job_task(app_instance, tmpdir, mocker):
 def test_delete_storage_service_task(app_instance, tmpdir, mocker):
     """Test that storage service gets deleted by delete storage service job task logic."""
     storage_service = test_helpers.create_test_storage_service()
+    test_helpers.create_test_agent()
+
+    assert Agent.query.filter_by(id=storage_service.id).count() == 1
 
     deleted_ss = StorageService.query.filter_by(id=storage_service.id).first()
     assert deleted_ss is not None
@@ -206,6 +209,7 @@ def test_delete_storage_service_task(app_instance, tmpdir, mocker):
 
     deleted_ss = StorageService.query.filter_by(id=storage_service.id).first()
     assert deleted_ss is None
+    assert Agent.query.filter_by(id=storage_service.id).count() == 0

@melaniekung melaniekung force-pushed the dev/91-ss-delete-rm-agents branch 3 times, most recently from 333bf80 to bd71355 Compare September 12, 2023 14:59
Copy link
Member

@mcantelon mcantelon left a comment

Choose a reason for hiding this comment

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

Looks good!

@melaniekung melaniekung merged commit 62b8ca7 into main Sep 12, 2023
7 checks passed
@melaniekung melaniekung deleted the dev/91-ss-delete-rm-agents branch September 12, 2023 20:34
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