diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e8e336c5fc789a9bc47574134599f41dea94eef5..7f96632c36e9b1caa7887e0fb323adc3fcf69678 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -265,6 +265,7 @@ integration_test_TMSS: RABBITMQ_DEFAULT_PASS: guest LOFAR_DEFAULT_BROKER: 'rabbitmq' # override default 'localhost' which does not work for CI service rabbitmq. needs: + - build_TMSS - unit_test_TMSS artifacts: name: integration-test-report @@ -289,6 +290,7 @@ integration_test_RAServices: - cd build/gnucxx11_opt - SKIP_INTEGRATION_TESTS=false SKIP_UNIT_TESTS=true ctest needs: + - build_RAServices - unit_test_RAServices artifacts: name: integration-test-report @@ -313,6 +315,7 @@ integration_test_LTAIngest: RABBITMQ_DEFAULT_PASS: guest LOFAR_DEFAULT_BROKER: 'rabbitmq' # override default 'localhost' which does not work for CI service rabbitmq. needs: + - build_LTAIngest - unit_test_LTAIngest artifacts: name: integration-test-report diff --git a/SAS/TMSS/test/t_tmssapp_specification_REST_API.py b/SAS/TMSS/test/t_tmssapp_specification_REST_API.py index 5bb9e175d4324f9ecdaa40176243dde8fa0da040..018c985f4b69f7b626564bda91f076dcc49591b9 100755 --- a/SAS/TMSS/test/t_tmssapp_specification_REST_API.py +++ b/SAS/TMSS/test/t_tmssapp_specification_REST_API.py @@ -1335,11 +1335,10 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): GET_OK_and_assert_equal_expected_response(self, url, test_data) def test_GET_SchedulingUnitDraft_list_view_shows_entry(self): - test_data_1 = SchedulingUnitDraft_test_data("scheduler unit draft one") - models.SchedulingUnitDraft.objects.create(**test_data_1) + obj = models.SchedulingUnitDraft.objects.create(**test_data_1) nbr_results = models.SchedulingUnitDraft.objects.count() - GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/scheduling_unit_draft/', test_data_1, nbr_results) + GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/scheduling_unit_draft/', test_data_1, nbr_results, obj.id) def test_GET_SchedulingUnitDraft_view_returns_correct_entry(self): @@ -1385,8 +1384,8 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): # setup test_data_1 = SchedulingUnitDraft_test_data("scheduler unit draft one") - tdt_test_data_1 = TaskDraft_test_data("task draft one") - tdt_test_data_2 = TaskDraft_test_data("task draft two") + tdt_test_data_1 = TaskDraft_test_data("task draft one of su1") + tdt_test_data_2 = TaskDraft_test_data("task draft two of su2 ") scheduling_unit_draft = models.SchedulingUnitDraft.objects.create(**test_data_1) task_draft_1 = models.TaskDraft.objects.create(**tdt_test_data_1) task_draft_1.scheduling_unit_draft = scheduling_unit_draft @@ -1522,9 +1521,9 @@ class TaskDraftTestCase(unittest.TestCase): def test_GET_TaskDraft_list_view_shows_entry(self): test_data_1 = TaskDraft_test_data("task draft") - models.TaskDraft.objects.create(**test_data_1) + obj = models.TaskDraft.objects.create(**test_data_1) nbr_results = models.TaskDraft.objects.count() - GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/task_draft/', test_data_1, nbr_results) + GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/task_draft/', test_data_1, nbr_results, obj.id) def test_GET_TaskDraft_view_returns_correct_entry(self): @@ -1540,7 +1539,7 @@ class TaskDraftTestCase(unittest.TestCase): def test_nested_TaskDraft_are_filtered_according_to_SchedulingUnitDraft(self): # setup - test_data_1 = TaskDraft_test_data("task draft one") + test_data_1 = TaskDraft_test_data("task draft three") sudt_test_data_1 = SchedulingUnitDraft_test_data("scheduling unit draft one") scheduling_unit_draft_1 = models.SchedulingUnitDraft.objects.create(**sudt_test_data_1) test_data_1 = dict(test_data_1) @@ -1552,7 +1551,7 @@ class TaskDraftTestCase(unittest.TestCase): def test_TaskDraft_contains_list_of_related_TaskBlueprint(self): # setup - test_data_1 = TaskDraft_test_data("task draft one") + test_data_1 = TaskDraft_test_data("task draft four") tbt_test_data_1 = TaskBlueprint_test_data() tbt_test_data_2 = TaskBlueprint_test_data() task_draft = models.TaskDraft.objects.create(**test_data_1) @@ -1569,7 +1568,7 @@ class TaskDraftTestCase(unittest.TestCase): def test_TaskDraft_contains_lists_of_related_TaskRelationDraft(self): # setup - test_data_1 = TaskDraft_test_data("task draft one") + test_data_1 = TaskDraft_test_data("task draft five") task_draft = models.TaskDraft.objects.create(**test_data_1) trdt_test_data_1 = TaskRelationDraft_test_data() diff --git a/SAS/TMSS/test/tmss_test_environment_unittest_setup.py b/SAS/TMSS/test/tmss_test_environment_unittest_setup.py index dc4f72644bf2b40058a6eb6571218f7cf6fd3d89..04b9882454838c474e06523d8017ebc9320aca07 100644 --- a/SAS/TMSS/test/tmss_test_environment_unittest_setup.py +++ b/SAS/TMSS/test/tmss_test_environment_unittest_setup.py @@ -134,7 +134,7 @@ def GET_and_assert_equal_expected_code(test_instance, url, expected_code): return r_dict -def GET_and_assert_in_expected_response_result_list(test_instance, url, expected_content, expected_nbr_results): +def GET_and_assert_in_expected_response_result_list(test_instance, url, expected_content, expected_nbr_results, expected_id=None): """ GET from url and assert the expected code is returned and the expected content is in the response content Use this check when multiple results (list) are returned @@ -159,7 +159,17 @@ def GET_and_assert_in_expected_response_result_list(test_instance, url, expected test_instance.assertIn(key, item.keys()) if url_check: - assertDataWithUrls(test_instance, r_dict['results'][expected_nbr_results-1], expected_content) + # Find the expected id in result list if parameter is given (of curse for just one it does not make sense) + # There was an 'old' assumption that the last one should taken, but that is not reliable + if expected_id is not None: + for idx in range(0, expected_nbr_results): + if r_dict['results'][idx]['id'] == expected_id: + expected_idx = idx + break + else: + # this is the 'old' assumption that last object added will also be the last one in the result dict + expected_idx = expected_nbr_results-1 + assertDataWithUrls(test_instance, r_dict['results'][expected_idx], expected_content) return r_dict