Skip to content

Commit

Permalink
upload: move dirac upload test to belle ii. rucio#6475
Browse files Browse the repository at this point in the history
  • Loading branch information
panta-123 committed Feb 6, 2024
1 parent f71ccf1 commit 503e16c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tests/test_belleii.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from datetime import datetime

import pytest
import os


from rucio.common.exception import InvalidObject
from rucio.common.schema.belleii import validate_schema
Expand Down Expand Up @@ -129,8 +131,10 @@ def test_belle2_schema(rse_factory, did_factory, root_account, did_client):
validate_schema('did', {'name': name, 'scope': scope, 'type': 'CONTAINER'})

@skip_non_belleii
def test_upload_file_with_dirac(rse, scope, upload_client, download_client, did_client, file_factory):
def test_upload_file_with_dirac(rse_factory, scope, rse_client, did_factory, download_client, did_client, file_factory):
"Upload with dirac (CLIENT): Test the functionality of the upload method"
rse1, rse1_id = rse_factory.make_srm_rse(deterministic=True)
rse_client.add_rse_attribute(rse=rse1, key='ANY', value='True')
config_set('dirac', 'lifetime', '{"user.*": 2592400}')
local_file1 = file_factory.file_generator(use_basedir=True)
local_file2 = file_factory.file_generator(use_basedir=True)
Expand All @@ -141,21 +145,21 @@ def test_upload_file_with_dirac(rse, scope, upload_client, download_client, did_
items = [
{
'path': local_file1,
'rse': rse,
'rse': rse1,
'did_scope': scope,
'did_name': fn1,
'guid': generate_uuid()
},
{
'path': local_file2,
'rse': rse,
'rse': rse1,
'did_scope': scope,
'did_name': fn2,
'guid': generate_uuid()
}
]

status = upload_client.upload(items)
status = did_factory.upload_client.upload(items, dirac=True)
assert status == 0
# download the files
did1 = f"{scope}:{fn1}"
Expand All @@ -164,7 +168,7 @@ def test_upload_file_with_dirac(rse, scope, upload_client, download_client, did_
{'did': did1, 'base_dir': download_dir},
{'did': did2, 'base_dir': download_dir}
])

print(os.listdir(download_dir))
# match checksums
downloaded_file1 = f"{download_dir}/{fn1}"
assert adler32(local_file1) == adler32(downloaded_file1)
Expand Down Expand Up @@ -192,13 +196,13 @@ def test_upload_file_with_dirac(rse, scope, upload_client, download_client, did_
items = [
{
'path': local_file3,
'rse': rse,
'rse': rse1,
'dataset_scope': scope,
'dataset_name': dataset_name,
'guid': generate_uuid()
}]

status = upload_client.upload(items)
status = did_factory.upload_client.upload(items, dirac=True)
assert status == 0

# Check for filename existence (dataset+local_file3)
Expand Down

0 comments on commit 503e16c

Please sign in to comment.