Skip to content

Commit

Permalink
Correcting integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nkongenelly committed Sep 23, 2024
1 parent b3d437c commit 0d26c3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
9 changes: 5 additions & 4 deletions delivery/services/staging_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ def _copy_dir(staging_order_id, external_program_service, session_factory, stagi

# Parse the file size from the output of rsync stats:
# Total file size: 207,707,566 bytes
match = re.search(r'Total file size: ([\d,]+) bytes',
execution_result.stdout,
re.MULTILINE)

match = re.search(r'Total file size: ([\d,.]+) bytes',
execution_result.stdout,
re.MULTILINE)
size_of_transfer = match.group(1)
size_of_transfer = int(size_of_transfer.replace(",", ""))
size_of_transfer = int(size_of_transfer.replace(",", "").replace(".", ""))
staging_order.size = size_of_transfer

staging_order.status = StagingStatus.staging_successful
Expand Down
13 changes: 7 additions & 6 deletions tests/integration_tests/test_integration_dds.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def test_can_stage_and_deliver_clean_flowcells(self):
prefix='160930_ST-E00216_0555_BH37CWALXX_') as tmpdir1,\
tempfile.TemporaryDirectory(dir='./tests/resources/runfolders/',
prefix='160930_ST-E00216_0556_BH37CWALXX_') as tmpdir2:
self._create_projects_dir_with_random_data(tmpdir1, 'XYZ_123')
self._create_projects_dir_with_random_data(tmpdir2, 'XYZ_123')
self._create_projects_dir_with_random_data(tmpdir1, 'XYZ_123', os.path.basename(tmpdir1))
self._create_projects_dir_with_random_data(tmpdir2, 'XYZ_123', os.path.basename(tmpdir2))

url = "/".join([self.API_BASE, "stage", "project", 'runfolders', 'XYZ_123'])
payload = {'delivery_mode': 'CLEAN'}
Expand All @@ -147,12 +147,13 @@ def test_can_stage_and_deliver_batch_flowcells(self):
prefix='160930_ST-E00216_0555_BH37CWALXX_') as tmpdir1, \
tempfile.TemporaryDirectory(dir='./tests/resources/runfolders/',
prefix='160930_ST-E00216_0556_BH37CWALXX_') as tmpdir2:
self._create_projects_dir_with_random_data(tmpdir1, 'XYZ_123')
self._create_projects_dir_with_random_data(tmpdir2, 'XYZ_123')
self._create_projects_dir_with_random_data(tmpdir1, 'XYZ_123', os.path.basename(tmpdir1))
self._create_projects_dir_with_random_data(tmpdir2, 'XYZ_123', os.path.basename(tmpdir2))

url = "/".join([self.API_BASE, "stage", "project", 'runfolders', 'XYZ_123'])
payload = {'delivery_mode': 'BATCH'}
response = yield self.http_client.fetch(self.get_url(url), method='POST', body=json.dumps(payload))

self.assertEqual(response.code, 202)

payload = {'delivery_mode': 'BATCH'}
Expand All @@ -177,7 +178,7 @@ def create_unorganised_test_runfolders(self, tmpdir):
unorganised_runfolder(
name=os.path.basename(tmpdir),
root_path=os.path.dirname(tmpdir))
)
)
@gen_test
def test_can_stage_and_deliver_force_flowcells(self):
with tempfile.TemporaryDirectory(dir='./tests/resources/runfolders/',
Expand All @@ -199,7 +200,7 @@ def test_can_stage_and_deliver_force_flowcells(self):
response2 = yield self.http_client.fetch(self.get_url(url), method='POST', body='')
self.assertEqual(response2.code, 200)

# Then just stage it
# Then stage it
url = "/".join([self.API_BASE, "stage", "project", 'runfolders', 'JKL_123'])
payload = {'delivery_mode': 'BATCH'}
response = yield self.http_client.fetch(self.get_url(url), method='POST', body=json.dumps(payload))
Expand Down

0 comments on commit 0d26c3e

Please sign in to comment.