Skip to content

Commit

Permalink
Merge pull request #4910 from rcarpa/patch-0-full_module_path_for_cac…
Browse files Browse the repository at this point in the history
…hes_mock

Tests: explicitly write full cache module when mocking
  • Loading branch information
bari12 committed Oct 19, 2021
2 parents f67cf9b + 774d888 commit 9247486
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion lib/rucio/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def caches_mock(request):
with ExitStack() as stack:
for module in caches_to_mock:
region = make_region().configure('dogpile.cache.memory', expiration_time=600)
stack.enter_context(mock.patch('{}.{}'.format(module, 'REGION'), new=region))
stack.enter_context(mock.patch(module, new=region))

yield

Expand Down
2 changes: 1 addition & 1 deletion lib/rucio/tests/test_abacus_collection_replica.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_abacus_collection_replica(self):
('reaper', 'remove_open_did', True)
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.config', 'rucio.core.replica'
'rucio.core.config.REGION', 'rucio.core.replica.REGION'
]}], indirect=True)
def test_abacus_collection_replica_new(vo, rse_factory, rucio_client, did_factory, core_config_mock, caches_mock):
""" ABACUS (COLLECTION REPLICA): Test update of collection replica. """
Expand Down
30 changes: 15 additions & 15 deletions lib/rucio/tests/test_conveyor.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ def set_query_parameters(url, params):
('transfers', 'multihop_tombstone_delay', -1), # Set OBSOLETE tombstone for intermediate replicas
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.rse_expression_parser', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config',
'rucio.daemons.reaper.reaper',
'rucio.core.rse_expression_parser.REGION', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config.REGION',
'rucio.daemons.reaper.reaper.REGION',
]}], indirect=True)
def test_multihop_intermediate_replica_lifecycle(vo, did_factory, root_account, core_config_mock, caches_mock, metrics_mock):
"""
Expand Down Expand Up @@ -198,8 +198,8 @@ def _cleanup_all_usage_and_limits(rse_id, session=None):
('transfers', 'use_multihop', True),
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.rse_expression_parser', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config',
'rucio.core.rse_expression_parser.REGION', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config.REGION',
]}], indirect=True)
def test_fts_non_recoverable_failures_handled_on_multihop(vo, did_factory, root_account, replica_client, core_config_mock, caches_mock, metrics_mock):
"""
Expand Down Expand Up @@ -244,8 +244,8 @@ def test_fts_non_recoverable_failures_handled_on_multihop(vo, did_factory, root_
('transfers', 'use_multihop', True),
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.rse_expression_parser', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config',
'rucio.core.rse_expression_parser.REGION', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config.REGION',
]}], indirect=True)
def test_fts_recoverable_failures_handled_on_multihop(vo, did_factory, root_account, replica_client, file_factory, core_config_mock, caches_mock, metrics_mock):
"""
Expand Down Expand Up @@ -296,8 +296,8 @@ def test_fts_recoverable_failures_handled_on_multihop(vo, did_factory, root_acco
('transfers', 'use_multihop', True),
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.rse_expression_parser', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config',
'rucio.core.rse_expression_parser.REGION', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config.REGION',
]}], indirect=True)
def test_multisource(vo, did_factory, root_account, replica_client, core_config_mock, caches_mock, metrics_mock):
src_rse1 = 'XRD4'
Expand Down Expand Up @@ -412,8 +412,8 @@ def test_multisource_receiver(vo, did_factory, replica_client, root_account, met
('transfers', 'use_multihop', True),
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.rse_expression_parser', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config',
'rucio.core.rse_expression_parser.REGION', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config.REGION',
]}], indirect=True)
def test_multihop_receiver_on_failure(vo, did_factory, replica_client, root_account, core_config_mock, caches_mock, metrics_mock):
"""
Expand Down Expand Up @@ -469,8 +469,8 @@ def test_multihop_receiver_on_failure(vo, did_factory, replica_client, root_acco
('transfers', 'use_multihop', True),
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.rse_expression_parser', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config',
'rucio.core.rse_expression_parser.REGION', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config.REGION',
]}], indirect=True)
def test_multihop_receiver_on_success(vo, did_factory, root_account, core_config_mock, caches_mock, metrics_mock):
"""
Expand Down Expand Up @@ -678,8 +678,8 @@ def __update_request(request_id, session=None, **kwargs):
('transfers', 'use_multihop', True)
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.rse_expression_parser', # The list of multihop RSEs is retrieved by an expression
'rucio.core.config',
'rucio.core.rse_expression_parser.REGION', # The list of multihop RSEs is retrieved by an expression
'rucio.core.config.REGION',
]}], indirect=True)
def test_overwrite_on_tape(rse_factory, did_factory, root_account, core_config_mock, caches_mock):
"""
Expand Down
4 changes: 2 additions & 2 deletions lib/rucio/tests/test_conveyor_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def _forge_requests_creation_time(session=None):
('transfers', 'use_multihop', True)
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.rse_expression_parser', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config',
'rucio.core.rse_expression_parser.REGION', # The list of multihop RSEs is retrieved by rse expression
'rucio.core.config.REGION',
]}], indirect=True)
def test_multihop_sources_created(rse_factory, did_factory, root_account, core_config_mock, caches_mock, metrics_mock):
"""
Expand Down
2 changes: 1 addition & 1 deletion lib/rucio/tests/test_replica.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def test_get_RSE_coverage_of_dataset(self, rse_factory, mock_scope, root_account
('reaper', 'remove_open_did', True)
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.config', 'rucio.core.replica'
'rucio.core.config.REGION', 'rucio.core.replica.REGION'
]}], indirect=True)
def test_delete_replicas_from_datasets_new(core_config_mock, caches_mock, rse_factory, mock_scope, root_account):
""" REPLICA (CORE): Delete replicas from dataset """
Expand Down
8 changes: 4 additions & 4 deletions lib/rucio/tests/test_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ def __fake_source_ranking(source_rse_id, new_ranking, session=None):
('transfers', 'use_multihop', True)
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.rse_expression_parser', # The list of multihop RSEs is retrieved by an expression
'rucio.core.config',
'rucio.core.rse_expression_parser.REGION', # The list of multihop RSEs is retrieved by an expression
'rucio.core.config.REGION',
]}], indirect=True)
def test_multihop_requests_created(rse_factory, did_factory, root_account, core_config_mock, caches_mock):
"""
Expand All @@ -244,8 +244,8 @@ def test_multihop_requests_created(rse_factory, did_factory, root_account, core_
('transfers', 'use_multihop', True)
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.rse_expression_parser', # The list of multihop RSEs is retrieved by an expression
'rucio.core.config',
'rucio.core.rse_expression_parser.REGION', # The list of multihop RSEs is retrieved by an expression
'rucio.core.config.REGION',
]}], indirect=True)
def test_singlehop_vs_multihop_priority(rse_factory, root_account, mock_scope, core_config_mock, caches_mock):
"""
Expand Down
2 changes: 1 addition & 1 deletion lib/rucio/tests/test_undertaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_atlas_archival_policy(self):
('undertaker', 'purge_all_replicas', True)
]}], indirect=True)
@pytest.mark.parametrize("caches_mock", [{"caches_to_mock": [
'rucio.core.config',
'rucio.core.config.REGION',
]}], indirect=True)
def test_removal_all_replicas2(rse_factory, root_account, mock_scope, core_config_mock, caches_mock):
""" UNDERTAKER (CORE): Test the undertaker is setting Epoch tombstone on all the replicas. """
Expand Down

0 comments on commit 9247486

Please sign in to comment.