Commit 5ba1b95a authored by Alejandro Alvarez Ayllon's avatar Alejandro Alvarez Ayllon
Browse files

FTS-704: Fix regression

parent 53205ce4
Pipeline #78305 failed with stage
in 19 seconds
......@@ -485,16 +485,15 @@ class JobBuilder(object):
self._set_job_source_and_destination(self.files)
# If reuse is enabled, source and destination SE must be the same
# for all entries
# If reuse is enabled, source and destination SE must be the same for all entries
# Ignore for multiple replica jobs!
if job_type == 'Y' and (not self.job['source_se'] or not self.job['dest_se']):
raise HTTPBadRequest('Reuse jobs can only contain transfers for the same source and destination storage')
if job_type == 'Y' and (self.job['source_se'] and self.job['dest_se']):
self.job['job_type'] == 'Y'
if job_type == 'N':
if job_type == 'N' and not self.is_multiple:
self.job['job_type'] = 'N'
if (self.job['source_se'] and self.job['dest_se'] and (job_type is None) and (len(self.files) > 1)) :
......
......@@ -188,6 +188,40 @@ class TestMultiple(TestController):
self.assertEqual(db_job.job_type, 'R')
def test_submit_with_alternatives3(self):
"""
Same as before, but reuse is set explicitly to False, which should be a no-op
(Regression bug)
"""
self.setup_gridsite_environment()
self.push_delegation()
job = {
'files': [
{
'sources': ['http://source.es/file', 'http://source.fr/file'],
'destinations': ['http://dest.ch/file'],
'selection_strategy': 'orderly',
'checksum': 'adler32:1234',
'filesize': 1024,
'activity': 'something something',
'metadata': {'mykey': 'myvalue'},
}
],
'params': {'reuse': False}
}
answer = self.app.post(url="/jobs",
content_type='application/json',
params=json.dumps(job),
status=200)
# Validate job in the database
job_id = json.loads(answer.body)['job_id']
db_job = Session.query(Job).get(job_id)
self.assertEqual(db_job.job_type, 'R')
def test_submit_multiple_transfers(self):
"""
Submit one job with multiple independent transfers
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment