Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
geomultisens
gms_preprocessing
Commits
12fe36a9
Commit
12fe36a9
authored
Oct 23, 2017
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tests/test_exception_handler.py
View file @
12fe36a9
...
...
@@ -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
)
...
...
Daniel Scheffler
@danschef
mentioned in commit
2b4ee945
·
Feb 06, 2018
mentioned in commit
2b4ee945
mentioned in commit 2b4ee9454290e5b11c28c36757c89e2117447b6c
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment