Skip to content
Snippets Groups Projects
Commit ce6917ce authored by Charlotte Hausman's avatar Charlotte Hausman
Browse files

fixing aux_image_metadata.json missing from staging area

parent 1c2c7389
No related branches found
No related tags found
1 merge request!400fixing aux_image_metadata.json missing from staging area
Pipeline #2421 passed
import glob
import os
import pathlib
import shutil import shutil
import subprocess import subprocess
import sys import sys
import logging import logging
import json
from ingest_envoy.schema import AbstractTextFile from ingest_envoy.schema import AbstractTextFile
...@@ -17,6 +12,9 @@ class ImageCollector: ...@@ -17,6 +12,9 @@ class ImageCollector:
self.logger = logging.getLogger("ingest_envoy") self.logger = logging.getLogger("ingest_envoy")
self.parameters = parameters self.parameters = parameters
self.spl = parameters["spl"] self.spl = parameters["spl"]
self.staging_source_dir = (
self.parameters["staging_area"] + "/" + self.parameters["workflowDir"]
)
def collect_image_metadata(self) -> AbstractTextFile: def collect_image_metadata(self) -> AbstractTextFile:
file = open("./aux_image_metadata.json", "r") file = open("./aux_image_metadata.json", "r")
...@@ -34,6 +32,13 @@ class ImageCollector: ...@@ -34,6 +32,13 @@ class ImageCollector:
stdout=sys.stdout, stdout=sys.stdout,
stderr=sys.stderr, stderr=sys.stderr,
) )
self.aux_file_to_staging()
def aux_file_to_staging(self):
shutil.copy2(
"./aux_image_metadata.json",
self.staging_source_dir,
)
def create_artifacts_name(self): def create_artifacts_name(self):
name = "pipeline_artifacts_" name = "pipeline_artifacts_"
......
...@@ -30,11 +30,17 @@ class TestImageCollector: ...@@ -30,11 +30,17 @@ class TestImageCollector:
assert mock_open.call_count == 1 assert mock_open.call_count == 1
assert isinstance(aux, AbstractTextFile) assert isinstance(aux, AbstractTextFile)
@patch("shutil.copy2")
@patch("subprocess.run") @patch("subprocess.run")
def test_collect_image_products(self, mock_run): def test_collect_image_products(self, mock_run, mock_copy):
image_collector.collect_image_products() image_collector.collect_image_products()
assert mock_run.call_count == 1 assert mock_run.call_count == 1
@patch("shutil.copy2")
def test_aux_file_to_staging(self, mock_copy):
image_collector.aux_file_to_staging()
assert mock_copy.call_count == 1
def test_create_artifacts_name(self): def test_create_artifacts_name(self):
expected_name = "pipeline_artifacts_" + parameters["processingStart"] expected_name = "pipeline_artifacts_" + parameters["processingStart"]
......
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