Skip to content

Commit

Permalink
Tests: upload prototype - rucio#3250
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasJavurek committed Jan 22, 2020
1 parent 10e6b3a commit d082a8f
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 27 deletions.
42 changes: 15 additions & 27 deletions etc/rse_repository.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"SWIFT": {
"site": "TEST",
"backend_type": "S3",
"deterministic": true,
"protocols": {
Expand Down Expand Up @@ -27,6 +28,7 @@
"storage_usage_tool": "rucio.rse.protocols.s3.Default.getSpace"
},
"AMAZON-BOTO": {
"site": "TEST",
"backend_type": "S3",
"deterministic": true,
"protocols": {
Expand Down Expand Up @@ -56,6 +58,7 @@
"storage_usage_tool": "rucio.rse.protocols.s3boto.Default.getSpace"
},
"BNL-BOTO": {
"site": "TEST",
"backend_type": "S3",
"deterministic": true,
"protocols": {
Expand Down Expand Up @@ -85,6 +88,7 @@
"storage_usage_tool": "rucio.rse.protocols.s3boto.Default.getSpace"
},
"CERN-S3-LOGS": {
"site": "TEST",
"backend_type": "S3",
"deterministic": true,
"protocols": {
Expand Down Expand Up @@ -114,6 +118,7 @@
"storage_usage_tool": "rucio.rse.protocols.s3http.Default.getSpace"
},
"LXPLUS":{
"site": "TEST",
"backend_type": "SFTP",
"deterministic": true,
"protocols": {
Expand Down Expand Up @@ -142,6 +147,7 @@
"storage_usage_tool": "rucio.rse.protocols.sftp.Default.getSpace"
},
"MOCK-POSIX":{
"site": "TEST",
"backend_type": "POSIX",
"deterministic": true,
"protocols": {
Expand All @@ -168,6 +174,7 @@
"storage_usage_tool": "rucio.rse.protocols.posix.Default.getSpace"
},
"MOCK":{
"site": "TEST",
"backend_type": "MOCK",
"city": "Upton",
"country_name": "United States",
Expand Down Expand Up @@ -237,6 +244,7 @@
"storage_usage_tool": "rucio.rse.protocols.posix.Default.getSpace"
},
"MOCK2":{
"site": "TEST",
"backend_type": "POSIX",
"deterministic": false,
"city": "Geneva",
Expand Down Expand Up @@ -291,6 +299,7 @@
"storage_usage_tool": "rucio.rse.protocols.posix.Default.getSpace"
},
"MOCK3":{
"site": "TEST",
"backend_type": "POSIX",
"deterministic": true,
"city": "Geneva",
Expand Down Expand Up @@ -363,33 +372,7 @@
"storage_usage_tool": "rucio.rse.protocols.posix.Default.getSpace"
},
"MOCK4":{
"backend_type": "POSIX",
"deterministic": true,
"protocols": {
"default": "file",
"supported": {
"file": {
"prefix": "/tmp/rucio_rse/",
"impl": "rucio.rse.protocols.posix.Default",
"extended_attributes": {"web_service_path": "/srm/managerv2?SFN=", "space_token": "ATLASDATATAPE"},
"domains": {
"lan": {
"read": 1,
"write": 1,
"delete": 1
},
"wan": {
"read": 1,
"write": 1,
"delete": 1
}
}
}
}
},
"storage_usage_tool": "rucio.rse.protocols.posix.Default.getSpace"
},
"MOCK5":{
"site": "TEST",
"backend_type": "POSIX",
"deterministic": true,
"protocols": {
Expand Down Expand Up @@ -417,6 +400,7 @@
"storage_usage_tool": "rucio.rse.protocols.posix.Default.getSpace"
},
"MOCK_SUSPICIOUS":{
"site": "TEST",
"backend_type": "POSIX",
"deterministic": true,
"protocols": {
Expand Down Expand Up @@ -444,6 +428,7 @@
"storage_usage_tool": "rucio.rse.protocols.posix.Default.getSpace"
},
"MOCK_RECOVERY":{
"site": "TEST",
"backend_type": "POSIX",
"deterministic": true,
"protocols": {
Expand Down Expand Up @@ -471,6 +456,7 @@
"storage_usage_tool": "rucio.rse.protocols.posix.Default.getSpace"
},
"FZK-LCG2_SCRATCHDISK":{
"site": "TEST",
"backend_type": "dCache",
"protocols": {
"default": "https",
Expand Down Expand Up @@ -517,6 +503,7 @@
"storage_usage_tool": "rucio.rse.protocols.webdav.Default.getSpace"
},
"CERN-PROD_TZERO":{
"site": "TEST",
"backend_type": "Castor",
"deterministic": false,
"protocols": {
Expand Down Expand Up @@ -546,6 +533,7 @@
"storage_usage_tool": "rucio.rse.protocols.webdav.Default.getSpace"
},
"WJ-XROOTD":{
"site": "TEST",
"backend_type": "XROOTD",
"deterministic": true,
"protocols": {
Expand Down
67 changes: 67 additions & 0 deletions lib/rucio/tests/test_upload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright 2019 CERN for the benefit of the ATLAS collaboration.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Authors:
# - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2019
# - Tobias Wegner <twegner@cern.ch>, 2019
# - Mario Lassnig <mario.lassnig@cern.ch>, 2019
#
# PY3K COMPATIBLE

import logging
import shutil

import nose.tools
import os.path

from rucio.client.client import Client
from rucio.client.uploadclient import UploadClient
from rucio.common.utils import generate_uuid
from rucio.tests.common import file_generator


class TestUploadClient(object):

def setup(self):
logger = logging.getLogger('dlul_client')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)
self.client = Client()
self.upload_client = UploadClient(_client=self.client, logger=logger)

self.file_path = file_generator()
self.scope = 'mock'
self.name = os.path.basename(self.file_path)
self.rse = select_rse()
self.guid = generate_uuid()

item = {'path': self.file_path,
'rse': self.rse,
'did_scope': self.scope,
'did_name': self.name,
'guid': self.guid}

def teardown(self):
shutil.rmtree('mock')

def select_rse(self):
# alg. for picking up rse(s)
return 'MOCK4'

def test_download_item(self):
""" DOWNLOAD (CLIENT): Download DIDs """

# Upload the test item
result = self.upload_client.upload([item])
nose.tools.assert_true(result)

0 comments on commit d082a8f

Please sign in to comment.