Commit 12fe36a9 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed wrong db host. Refactored some test functions.

parent 6de517bc
Pipeline #1406 passed with stage
in 8 minutes and 25 seconds
......@@ -22,7 +22,7 @@ class BaseTest_ExceptionHandler:
PC = None # default
def get_process_controller(self, jobID):
self.PC = process_controller(jobID, parallelization_level='scenes', db_host='localhost',
self.PC = process_controller(jobID, parallelization_level='scenes', db_host='geoms',
job_config_kwargs=dict(is_test=True, log_level='DEBUG'))
# update attributes of DB_job_record and related DB entry
......@@ -59,18 +59,18 @@ class Test_ExceptionHandler_NoSubsystems(BaseTest_ExceptionHandler.Test_Exceptio
def setUp(self):
super().get_process_controller(26186261) # Landsat-8 Coll. Data
def test_L1A_mapper_success(self):
def test_L1A_mapper_success_progress_stats(self):
"""Check correctness of progress stats if scene succeeds."""
self.dummy_L1A_mapper_success(self.PC.usecase.data_list[0])
self.assertEqual(self.get_current_progress_stats(), [0, 0, 1, 0, 0, 0, 0, 0, 0])
def test_gms_mapper_fail(self):
def test_gms_mapper_fail_progress_stats(self):
"""Check correctness of progress stats if scene fails."""
outObj = self.dummy_gms_mapper_fail(self.PC.usecase.data_list[0])
self.assertTrue(self.is_sceneid_in_failedIDs(outObj.scene_ID))
self.assertEqual(self.get_current_progress_stats(), [0, 0, 0, 0, 0, 0, 0, 0, 1])
def test_gms_mapper_fail_excH_off(self):
def test_disabled_exception_handler(self):
"""Check if exception handler raises exceptions of CFG.Job.disable_exception_handler = True."""
self.PC.job.disable_exception_handler = True
self.assertRaises(RuntimeError, self.dummy_gms_mapper_fail, self.PC.usecase.data_list[0])
......@@ -81,7 +81,7 @@ class Test_ExceptionHandler_Subsystems(BaseTest_ExceptionHandler.Test_ExceptionH
def setUp(self):
super().get_process_controller(26186268) # Sentinel-2
def test_L1A_mapper_success(self):
def test_L1A_mapper_success_progress_stats(self):
"""Check correctness of progress stats if all subsystems succeed."""
for subObj in self.PC.usecase.data_list:
self.dummy_L1A_mapper_success(subObj)
......@@ -92,7 +92,7 @@ class Test_ExceptionHandler_Subsystems(BaseTest_ExceptionHandler.Test_ExceptionH
# validate that stats only show ONE scene instead of the number of subsystems
self.assertEqual(self.get_current_progress_stats(), [0, 0, 1, 0, 0, 0, 0, 0, 0])
def test_gms_mapper_fail_firstSS(self):
def test_gms_mapper_fail_firstSS_progress_stats(self):
"""Check correctness of progress stats if the first subsystem first fails and another one succeeds."""
for i, subObj in enumerate(self.PC.usecase.data_list):
if subObj['subsystem'] == 'S2A10':
......@@ -110,15 +110,15 @@ class Test_ExceptionHandler_Subsystems(BaseTest_ExceptionHandler.Test_ExceptionH
self.assertEqual(self.get_current_progress_stats(), [0, 0, 0, 0, 0, 0, 0, 0, 1])
@unittest.SkipTest
def test_gms_mapper_fail_secondSS(self):
def test_gms_mapper_fail_secondSS_progress_stats(self):
"""Check correctness of progress stats if a first subsystem succeeds and then another one fails.
NOTE: This happens quite rarely because if a mapper fails for a subsystem, it usualy fails for the first
subsystem it receives."""
# TODO: This test currently fails because earlier subsystem updates stats from
# TODO: [0, 1, 0, 0, 0, 0, 0, 0, 0] to [0, 0, 1, 0, 0, 0, 0, 0, 0] and later one from
# TODO: [0, 0, 1, 0, 0, 0, 0, 0, 0] to [0, -1, 1, 0, 0, 0, 0, 0, 1]
# TODO: This is known bug.
# FIXME: This test currently fails because earlier subsystem updates stats from
# FIXME: [0, 1, 0, 0, 0, 0, 0, 0, 0] to [0, 0, 1, 0, 0, 0, 0, 0, 0] and later one from
# FIXME: [0, 0, 1, 0, 0, 0, 0, 0, 0] to [0, -1, 1, 0, 0, 0, 0, 0, 1]
# FIXME: This is known bug (issue # 50).
for i, subObj in enumerate(self.PC.usecase.data_list):
if subObj['subsystem'] == 'S2A10':
self.dummy_L1A_mapper_success(subObj)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment