Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fts-rest-flask
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
File Transfer Service
fts-rest-flask
Merge requests
!39
migrate test staging
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
migrate test staging
FTS-1588
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Carles Garcia Cabot
requested to merge
FTS-1588
into
master
4 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
Closes
FTS-1588
👍
0
👎
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
2bae1cce
1 commit,
4 years ago
1 file
+
184
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/fts3rest/fts3rest/tests/functional/test_staging.py
0 → 100644
+
184
−
0
Options
import
json
from
fts3rest.tests
import
TestController
from
fts3rest.model.meta
import
Session
from
fts3.model
import
Job
class
TestSubmitToStaging
(
TestController
):
"""
Tests for the job controller
Focus in staging transfers
"""
def
test_submit_to_staging
(
self
):
"""
Submit a job into staging
"""
self
.
setup_gridsite_environment
()
self
.
push_delegation
()
job
=
{
"
files
"
:
[
{
"
sources
"
:
[
"
srm://source.es/file
"
],
"
destinations
"
:
[
"
srm://dest.ch/file
"
],
"
selection_strategy
"
:
"
orderly
"
,
"
checksum
"
:
"
adler32:1234
"
,
"
filesize
"
:
1024
,
"
metadata
"
:
{
"
mykey
"
:
"
myvalue
"
},
}
],
"
params
"
:
{
"
overwrite
"
:
True
,
"
copy_pin_lifetime
"
:
3600
,
"
bring_online
"
:
60
,
"
verify_checksum
"
:
True
,
},
}
job_id
=
self
.
app
.
post
(
url
=
"
/jobs
"
,
content_type
=
"
application/json
"
,
params
=
json
.
dumps
(
job
),
status
=
200
,
).
json
[
"
job_id
"
]
# Make sure it was committed to the DB
self
.
assertGreater
(
len
(
job_id
),
0
)
db_job
=
Session
.
query
(
Job
).
get
(
job_id
)
self
.
assertEqual
(
db_job
.
job_state
,
"
STAGING
"
)
self
.
assertEqual
(
db_job
.
files
[
0
].
file_state
,
"
STAGING
"
)
return
job_id
def
test_submit_to_staging_no_lifetime
(
self
):
"""
Submit a job into staging, with pin lifetime not set
"""
self
.
setup_gridsite_environment
()
self
.
push_delegation
()
job
=
{
"
files
"
:
[
{
"
sources
"
:
[
"
srm://source.es/file
"
],
"
destinations
"
:
[
"
srm://dest.ch/file
"
],
"
selection_strategy
"
:
"
orderly
"
,
"
checksum
"
:
"
adler32:1234
"
,
"
filesize
"
:
1024
,
"
metadata
"
:
{
"
mykey
"
:
"
myvalue
"
},
}
],
"
params
"
:
{
"
overwrite
"
:
True
,
"
bring_online
"
:
60
,
"
verify_checksum
"
:
True
},
}
job_id
=
self
.
app
.
post
(
url
=
"
/jobs
"
,
content_type
=
"
application/json
"
,
params
=
json
.
dumps
(
job
),
status
=
200
,
).
json
[
"
job_id
"
]
# Make sure it was committed to the DB
self
.
assertGreater
(
len
(
job_id
),
0
)
db_job
=
Session
.
query
(
Job
).
get
(
job_id
)
self
.
assertEqual
(
db_job
.
job_state
,
"
STAGING
"
)
self
.
assertEqual
(
db_job
.
files
[
0
].
file_state
,
"
STAGING
"
)
return
job_id
def
test_multiple_bringonline
(
self
):
"""
Test a bring online job, with multiple files
"""
self
.
setup_gridsite_environment
()
self
.
push_delegation
()
job
=
{
"
files
"
:
[
{
"
sources
"
:
[
"
srm://source.es/?SFN=/path/
"
],
"
destinations
"
:
[
"
srm://dest.ch/file
"
],
},
{
"
sources
"
:
[
"
srm://source.es/?SFN=/path/file2
"
],
"
destinations
"
:
[
"
srm://dest.ch/file2
"
],
},
{
"
sources
"
:
[
"
srm://source.es/?SFN=/path/file3
"
],
"
destinations
"
:
[
"
srm://dest.ch/file3
"
],
},
],
"
params
"
:
{
"
overwrite
"
:
True
,
"
copy_pin_lifetime
"
:
3600
,
"
bring_online
"
:
60
,
"
verify_checksum
"
:
True
,
},
}
job_id
=
self
.
app
.
post
(
url
=
"
/jobs
"
,
content_type
=
"
application/json
"
,
params
=
json
.
dumps
(
job
),
status
=
200
,
).
json
[
"
job_id
"
]
# Make sure it was committed to the DB
self
.
assertGreater
(
len
(
job_id
),
0
)
db_job
=
Session
.
query
(
Job
).
get
(
job_id
)
self
.
assertEqual
(
db_job
.
job_state
,
"
STAGING
"
)
self
.
assertEqual
(
len
(
db_job
.
files
),
3
)
# "Hashed" id must be equal so bulk bring online calls can be made
# See https://its.cern.ch/jira/browse/FTS-145
hid
=
db_job
.
files
[
0
].
hashed_id
for
f
in
db_job
.
files
:
self
.
assertEqual
(
f
.
file_state
,
"
STAGING
"
)
self
.
assertEqual
(
f
.
hashed_id
,
hid
)
def
test_submit_to_staging_no_bring_online
(
self
):
"""
Submit a job into staging, with bring_online not set
"""
self
.
setup_gridsite_environment
()
self
.
push_delegation
()
job
=
{
"
files
"
:
[
{
"
sources
"
:
[
"
srm://source.es/file
"
],
"
destinations
"
:
[
"
srm://dest.ch/file
"
],
"
selection_strategy
"
:
"
orderly
"
,
"
checksum
"
:
"
adler32:1234
"
,
"
filesize
"
:
1024
,
"
metadata
"
:
{
"
mykey
"
:
"
myvalue
"
},
}
],
"
params
"
:
{
"
overwrite
"
:
True
,
"
copy_pin_lifetime
"
:
60
,
"
verify_checksum
"
:
True
,
},
}
job_id
=
self
.
app
.
post
(
url
=
"
/jobs
"
,
content_type
=
"
application/json
"
,
params
=
json
.
dumps
(
job
),
status
=
200
,
).
json
[
"
job_id
"
]
# Make sure it was committed to the DB
self
.
assertGreater
(
len
(
job_id
),
0
)
db_job
=
Session
.
query
(
Job
).
get
(
job_id
)
self
.
assertEqual
(
db_job
.
job_state
,
"
STAGING
"
)
self
.
assertEqual
(
db_job
.
files
[
0
].
file_state
,
"
STAGING
"
)
return
job_id
Loading