Clinical-Genomics / housekeeper

File data orchestrator
MIT License
2 stars 0 forks source link

(Archiving) Add cascade property to Archive #184

Closed islean closed 11 months ago

islean commented 11 months ago

Description

When deleting a file entry in Housekeeper, any associated entry in the Archive table (i.e. with a matching file_id) should also be deleted. Currently one can not delete a file when there is an archive entry associated to it. This PR adds that cascade property and adds some tests.

Fixed

Testing

How to prepare for test

housekeeper-test-deploy cascade-archive
housekeeper-test <command here>

Any migrations need to be applied manually with alembic against the stage database.

How to test

Expected test outcome

Review

This version is a:

islean commented 11 months ago

Currently in stage when trying to delete a file with an associated Archive entry:

AssertionError: Dependency rule tried to blank-out primary key column 'archive.file_id' on instance '<Archive at 0x7f6a1cec2b90>'
1d [isak.ohlsson@hasta:~] [S_base] 8s 1 $ 
islean commented 11 months ago

In the feature branch:

θ60° 1d [isak.ohlsson@hasta:~] [S_base] $ housekeeper-test delete file 5057208
2023-12-11 15:59:06 hasta.scilifelab.se housekeeper.cli.core[167283] INFO Use root path /home/proj/stage/housekeeper-bundles
Remove file /home/proj/stage/housekeeper-bundles/isaks_test_bundle/2023-12-06/isaks_test_spring_file.spring from file system and database? [y/N]: y
2023-12-11 15:59:22 hasta.scilifelab.se housekeeper.cli.delete[167283] INFO file deleted
θ60° 1d [isak.ohlsson@hasta:~] [S_base] 21s $ 
sonarcloud[bot] commented 11 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

islean commented 11 months ago

Deployed to stage and production:

Storing signatures
INFO:    Creating SIF file...
INFO:    Build complete: /home/proj/stage/singularity_containers/housekeeper_temp.sif
Successfully pulled the latest Housekeeper image.
1d [isak.ohlsson@hasta:~] [base] 17s $