Skip to content
Snippets Groups Projects
Commit 90d0144a authored by Janet Goldstein's avatar Janet Goldstein
Browse files

WS-601: build the ingestion artifacts tar filename only once

parent ab50471a
No related branches found
No related tags found
1 merge request!394WS-601: build the ingestion artifacts tar filename only once
Pipeline #2395 passed
......@@ -203,7 +203,7 @@ class IngestionManifestBuilder:
manifest.output_group.ancillary_products.append(artifacts_ap)
manifest_file = manifest.write()
artifacts_file = self.staging_source_dir / self._build_artifacts_filename()
artifacts_file = self.staging_source_dir / artifacts_filename
self.write_ingestion_artifacts_tar(artifacts_file)
return manifest, manifest_file
......
......@@ -7,6 +7,8 @@ import sys
from pathlib import Path
# pylint: disable=E0401, E0402, R1721, W0621
from unittest.mock import patch
import pytest
import tarfile
......@@ -227,6 +229,31 @@ def test_output_group_well_formed():
assert actual_json == expected_json
def test_ingestion_artifacts_tar_filename_built_just_once(ingest_path: Path):
"""
We run into trouble if manifest builder's _build_artifacts_filename()
is called more than once.
:param ingest_path:
:return:
"""
populate_fake_evla_cal_ingest_path(ingest_path)
with patch(
"ingest_envoy.ingestion_manifest.IngestionManifestBuilder._build_artifacts_filename",
return_value="ingestion_artifacts_mine_mine_mine.tar",
) as mock:
# build the manifest
IngestionManifestBuilder(
staging_source_dir=ingest_path,
sp_type=ScienceProductType.EVLA_CAL.value,
locator="uid://evla/calibration/are-we-there-yet",
telescope=Telescope.EVLA.value,
).build()
mock.assert_called_once()
shutil.rmtree(ingest_path)
def test_ingestion_artifacts_tar_correct(ingest_path: Path):
"""
Do we build the correct ingestion_artifacts tar for for standard imaging ingestion?
......@@ -256,6 +283,8 @@ def test_ingestion_artifacts_tar_correct(ingest_path: Path):
mf_path = Path(member.name)
assert mf_path.name == MANIFEST_FILENAME
shutil.rmtree(ingest_path)
def test_evla_cal_manifest_matches_example(ingest_path: Path):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment