Skip to content
Snippets Groups Projects
Commit aba20b79 authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #10698: Test explicitly if only observations and pipelines are handled by...

Task #10698: Test explicitly if only observations and pipelines are handled by checkUnRunTasksForMoMOpenedStatus, and whether tasks not in MoMDB are actually deleted.
parent 03281ca2
Branches
Tags
No related merge requests found
...@@ -137,6 +137,23 @@ class ScheduleCheckerTest(unittest.TestCase): ...@@ -137,6 +137,23 @@ class ScheduleCheckerTest(unittest.TestCase):
self.assertFalse(self.curpc_mock.removeTaskData.called, "Task output was deleted from disk") self.assertFalse(self.curpc_mock.removeTaskData.called, "Task output was deleted from disk")
self.assertFalse(self.rarpc_mock.deleteSpecification.called, "Object was removed from RADB") self.assertFalse(self.rarpc_mock.deleteSpecification.called, "Object was removed from RADB")
def test_checkUnRunTasksForMoMOpenedStatus_mom_notexisting_otdb_approved(self):
""" Test if a task is not in MoM, and 'approved' in OTDB. This causes the task to be deleted. """
self.momrpc_mock.getProjectDetails.return_value = {}
with TestingScheduleChecker(self.rarpc_mock, self.momrpc_mock, self.curpc_mock) as schedulechecker:
schedulechecker.checkUnRunTasksForMoMOpenedStatus()
self.assertTrue(self.rarpc_mock.deleteSpecification.called, "Object was not removed from RADB")
def test_checkUnRunTasksForMoMOpenedStatus_only_observations_pipelines(self):
""" Test if only observations and pipelines are compared against the MoMDB (and not maintenance or reservation tasks, for example). """
with TestingScheduleChecker(self.rarpc_mock, self.momrpc_mock, self.curpc_mock) as schedulechecker:
schedulechecker.checkUnRunTasksForMoMOpenedStatus()
self.assertEquals(self.rarpc_mock.getTasks.call_args[1]["task_type"], ['observation', 'pipeline'], "Only observations and pipelines must be matched against MoMDB")
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment