diff --git a/apps/cli/executables/pexable/ingest_envoy/ingest_envoy/ingestion_manifest.py b/apps/cli/executables/pexable/ingest_envoy/ingest_envoy/ingestion_manifest.py index 282cea855b9ab1e94f1028bdda5fb196ba7eacc6..1aded5b1655cfa0dc49325dd07081316ee9320ec 100644 --- a/apps/cli/executables/pexable/ingest_envoy/ingest_envoy/ingestion_manifest.py +++ b/apps/cli/executables/pexable/ingest_envoy/ingest_envoy/ingestion_manifest.py @@ -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 diff --git a/apps/cli/executables/pexable/ingest_envoy/test/test_evla_cal_manifest.py b/apps/cli/executables/pexable/ingest_envoy/test/test_evla_cal_manifest.py index ef74962afd429a5b4ae6c5ed6587ef63bf04cb18..81d122d0926df4a34310ed20c620402145248575 100644 --- a/apps/cli/executables/pexable/ingest_envoy/test/test_evla_cal_manifest.py +++ b/apps/cli/executables/pexable/ingest_envoy/test/test_evla_cal_manifest.py @@ -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): """