diff --git a/SAS/TMSS/backend/services/copy_service/t_copy_service.py b/SAS/TMSS/backend/services/copy_service/t_copy_service.py index 932d3b6a6d30ea9c8d26df7982f0ffc88da030df..45e82fd15354a870303595680e6eb5cf1e613ef4 100755 --- a/SAS/TMSS/backend/services/copy_service/t_copy_service.py +++ b/SAS/TMSS/backend/services/copy_service/t_copy_service.py @@ -20,6 +20,7 @@ import unittest import uuid import os +from unittest import mock import logging logger = logging.getLogger('lofar.'+__name__) @@ -63,8 +64,17 @@ class TestCopyService(unittest.TestCase): cls.tmss_test_env.stop() cls.tmp_exchange.close() + def setUp(self): + def mocked_wrap_command_in_cep4_head_node_ssh_call(cmd, *args, **kwargs): + logger.info('mocked_wrap_command_in_cep4_head_node_ssh_call returning original command (without ssh): %s', ' '.join(cmd)) + return cmd - def test_copy(self): + wrap_command_in_cep4_head_node_ssh_call_patcher = mock.patch('lofar.sas.tmss.services.copy_service.wrap_command_in_cep4_available_node_with_lowest_load_ssh_call') + self.addCleanup(wrap_command_in_cep4_head_node_ssh_call_patcher.stop) + self.wrap_command_in_cep4_head_node_ssh_call_mock = wrap_command_in_cep4_head_node_ssh_call_patcher.start() + self.wrap_command_in_cep4_head_node_ssh_call_mock.side_effect = mocked_wrap_command_in_cep4_head_node_ssh_call + + def test_copy_managed_and_unmanaged(self): from lofar.sas.tmss.tmss.tmssapp.models import SchedulingUnitObservingStrategyTemplate, SchedulingSet, SubtaskType from lofar.sas.tmss.tmss.tmssapp.tasks import create_scheduling_unit_draft_from_observing_strategy_template, create_scheduling_unit_blueprint_and_tasks_and_subtasks_from_scheduling_unit_draft, create_cleanuptask_for_scheduling_unit_blueprint from lofar.sas.tmss.tmss.tmssapp.subtasks import schedule_subtask, wait_for_subtask_status diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/populate.py b/SAS/TMSS/backend/src/tmss/tmssapp/populate.py index ff09c76dfa86b20a19ca114ef9647a41090b0032..915ce6b0588ac2bf80d9f23611b4e8718f52c17f 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/populate.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/populate.py @@ -617,8 +617,7 @@ def populate_misc(apps, schema_editor): elif isTestEnvironment(): Filesystem.objects.create(name="Test Storage (CIT)", cluster=cep4_cluster, capacity=3.6e15, directory="/data/test-projects") else: - localhost = Cluster.objects.create(name="localhost", location="local", archive_site=False) - Filesystem.objects.create(name="Development Test FS", cluster=localhost, capacity=1e9, directory="/tmp") + Filesystem.objects.create(name="Development Test FS", cluster=cep4_cluster, capacity=1e9, directory="/tmp") # LTA-site clusters sara_cluster = Cluster.objects.create(name="SARA", location="SARA", archive_site=True) diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py b/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py index db6f09db0d2e7f3c4af2b817de793855de108b6d..6c8e15bfe8d1ace50bd93db66f17bd45640876cf 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py @@ -660,7 +660,7 @@ def create_observation_control_subtask_from_task_blueprint(task_blueprint: TaskB raise SubtaskCreationException("Total number of subbands %d exceeds the maximum of 488 for task_blueprint id=%s" % (len(all_subbands), task_blueprint.id)) # step 1: create subtask in defining state - cluster_name = task_blueprint.specifications_doc.get("correlator", {}).get("storage_cluster", "CEP4") if isProductionEnvironment() else "localhost" + cluster_name = task_blueprint.specifications_doc.get("correlator", {}).get("storage_cluster", "CEP4") subtask_data = { "scheduled_start_time": None, "scheduled_stop_time": None, "state": SubtaskState.objects.get(value=SubtaskState.Choices.DEFINING.value),