From 38a16ea8c9c17a251d61a1068302cea80c843d4d Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Fri, 5 Jan 2024 13:38:35 +0100
Subject: [PATCH] tests should pass again

---
 .gitlab-ci.yml                                            | 6 +++---
 .../scheduling/test/t_subtask_scheduling_service.py       | 8 ++++++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e35c2a22bb4..cace202c8c5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -455,7 +455,7 @@ integration_test_TMSS_Frontend:
 
 dockerize_TMSS:
   stage: dockerize
-  allow_failure: true
+  allow_failure: false
   script:
     - cd build/gnucxx11_opt
     - docker build --build-arg TMSS_VERSION=$CI_COMMIT_SHORT_SHA --build-arg TMSS_COPY_DIR=install/opt/lofar -t tmss_django:$CI_COMMIT_SHORT_SHA -f docker/Dockerfile-tmss .
@@ -544,7 +544,7 @@ unit_and_integration_and_regression_test_TMSS:
     - cd build/gnucxx11_opt
     - SKIP_PYTHON_COVERAGE=true SKIP_INTEGRATION_TESTS=false SKIP_UNIT_TESTS=false SKIP_REGRESSION_TESTS=false ctest --output-on-failure
   interruptible: true
-  allow_failure: true
+  allow_failure: false
   rules:
   - if: '$CI_COMMIT_BRANCH !~ /Front-End-Only/'
   needs:
@@ -711,7 +711,7 @@ deploy-tmss-dockerhub:
       artifacts: false
     - job: unit_and_integration_and_regression_test_TMSS
       artifacts: false
-  allow_failure: true
+  allow_failure: false
   when: manual
   rules:
     - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"'
diff --git a/SAS/TMSS/backend/services/scheduling/test/t_subtask_scheduling_service.py b/SAS/TMSS/backend/services/scheduling/test/t_subtask_scheduling_service.py
index 8922ee7d206..c408f0e8551 100755
--- a/SAS/TMSS/backend/services/scheduling/test/t_subtask_scheduling_service.py
+++ b/SAS/TMSS/backend/services/scheduling/test/t_subtask_scheduling_service.py
@@ -153,13 +153,17 @@ class TestSubtaskSchedulingService(unittest.TestCase):
                     strategy_template.template['tasks'][obs_task_name]['specifications_doc']['QA'][qa_subtask_type]['enabled'] = True
             strategy_template.save()
 
+            constraints_template = models.SchedulingConstraintsTemplate.get_version_or_latest(name=strategy_template.template.get('scheduling_constraints_template', {}).get('name', 'constraints'),
+                                                                                              version=strategy_template.template.get('scheduling_constraints_template', {}).get('version'))
+            constraints_doc = constraints_template.get_default_json_document_for_schema()
+
             spec = add_defaults_to_json_object_for_schema(strategy_template.template, strategy_template.scheduling_unit_template.schema)
             scheduling_unit_draft = models.SchedulingUnitDraft.objects.create(name="IM HBA LoTSS - 2 Beams",
                                                                               scheduling_set=models.SchedulingSet.objects.create(**SchedulingSet_test_data()),
                                                                               specifications_template=strategy_template.scheduling_unit_template,
                                                                               observation_strategy_template=strategy_template,
-                                                                              scheduling_constraints_doc=get_default_json_object_for_schema(models.SchedulingConstraintsTemplate.get_version_or_latest(name="constraints").schema),
-                                                                              scheduling_constraints_template=models.SchedulingConstraintsTemplate.get_version_or_latest(name="constraints"))
+                                                                              scheduling_constraints_doc=constraints_doc,
+                                                                              scheduling_constraints_template=constraints_template)
 
             update_task_graph_from_specifications_doc(scheduling_unit_draft, spec)
             scheduling_unit_blueprint = create_scheduling_unit_blueprint_and_tasks_and_subtasks_from_scheduling_unit_draft(scheduling_unit_draft)
-- 
GitLab