Skip to content

Commit

Permalink
Tests/Undertaker Wrote undertaker tests
Browse files Browse the repository at this point in the history
Added tests to cover more of the undertaker functionality. This was
triggered by issue rucio#5154.

`test_file_did_deletion` tests how the undertaker handles a file DID
that is not attached to any dataset. It asserts that the epoch tombstone
is set on the file replica, regardless of whether rules exist on the
file DID (parametrised via a pytest fixture). Furthermore, the file DID must not be deleted, as this is the
Reaper's job.

`test_file_dids_in_dataset` tests how the undertaker handles an expired
file DID that belongs to a non-expired dataset among with other files.
It asserts that the expired file is detached and its replicas receive
the epoch tombstone. Furthermore, the other files are unchanged.

`test_file_protected_by_rule` sets up a system in which two files belong
to an expired dataset. At the same time, one of these files is protected
by a rule. The expected outcome is that the unprotected file DID is
detached from the dataset and its replica is tombstoned. On the other
hand, the protected file DID is detached from the dataset, and its
replicas protected by the dataset rule are epoch-tombstoned while its
replicas protected by the external rule remain unchanged. Finally, it is
asserted that the file DIDs remain whereas the dataset DID is deleted.

`test_file_protected_by_dataset` has a similar setup to
`test_file_protected_by_rule`, but instead of a rule acting directly on
the protected file, the protected file is shared between an expired DID
and a non-expired DID. We expect the unprotected file DID to be detached
and its replica to receive the epoch tombstone. Furthermore, we expect
the protected file DID to be detached from the expired dataset but
remain attached to the non-expired dataset; with the protected replica
remaining untouched and the unprotected replica being epoch-tombstoned.

As with the pre-existing `test_removal_all_replicas2`, the tests have
been parametrised to test both `use_temp_tables: True` and `False`.

The pre-existing test `TestUndertaker::test_undertaker` was changed to
include an assertion that the expired dataset DIDs were deleted by the
undertaker. In addition, we assert that the replicas have the
epoch-tombstone (marked by `rucio.db.sqla.constants.OBSOLETE`), instead
of asserting `is not None` (which is more generic and could also include
non-epoch-tombstones).
  • Loading branch information
ThePhisch committed Feb 8, 2023
1 parent 0c4360b commit 8fbc675
Showing 1 changed file with 382 additions and 14 deletions.

0 comments on commit 8fbc675

Please sign in to comment.