Skip to content

Commit bd0288c

Browse files
committed
add test for unsigned partial job results #786
1 parent aedc709 commit bd0288c

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

tests/test_api_result.py

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4121,9 +4121,53 @@ def item_json(path):
41214121
" https://openeo.test/openeo/jobs/j-2402094545c945c09e1307503aa58a3a/results?partial=true: finished"
41224122
in caplog.messages)
41234123

4124-
def test_load_stac_from_unsigned_partial_job_results(self):
4124+
@gps_config_overrides(job_dependencies_poll_interval_seconds=0)
4125+
def test_load_stac_from_unsigned_partial_job_results_basic(self, api110, batch_job_output_root, zk_job_registry,
4126+
backend_implementation, caplog):
41254127
"""load_stac from partial job results Collection (unsigned case)"""
4126-
raise NotImplementedError("TODO")
4128+
4129+
caplog.set_level("DEBUG")
4130+
4131+
# get results from own batch job rather than crawl signed STAC URLs
4132+
_setup_existing_job(
4133+
job_id="j-2405078f40904a0b85cf8dc5dd55b07e",
4134+
api=api110,
4135+
batch_job_output_root=batch_job_output_root,
4136+
zk_job_registry=zk_job_registry
4137+
)
4138+
4139+
process_graph = {
4140+
"loadstac1": {
4141+
"process_id": "load_stac",
4142+
"arguments": {
4143+
"url": "https://openeo.test/openeo/jobs/j-2405078f40904a0b85cf8dc5dd55b07e/results?partial=true"
4144+
}
4145+
},
4146+
"saveresult1": {
4147+
"process_id": "save_result",
4148+
"arguments": {"data": {"from_node": "loadstac1"}, "format": "GTiff"},
4149+
"result": True
4150+
},
4151+
}
4152+
4153+
from openeogeotrellis.load_stac import extract_own_job_info
4154+
4155+
finished_job_info = extract_own_job_info(
4156+
"https://openeo.test/openeo/jobs/j-2405078f40904a0b85cf8dc5dd55b07e/results?partial=true",
4157+
TEST_USER,
4158+
backend_implementation.batch_jobs
4159+
)
4160+
4161+
ongoing_job_info = finished_job_info._replace(status='queued')
4162+
4163+
with mock.patch("openeogeotrellis.load_stac.extract_own_job_info",
4164+
side_effect=[ongoing_job_info, finished_job_info]):
4165+
api110.result(process_graph).assert_status_code(200)
4166+
4167+
assert ("OpenEO batch job results status of own job j-2405078f40904a0b85cf8dc5dd55b07e: running"
4168+
in caplog.messages)
4169+
assert ("OpenEO batch job results status of own job j-2405078f40904a0b85cf8dc5dd55b07e: finished"
4170+
in caplog.messages)
41274171

41284172

41294173
class TestEtlApiReporting:

0 commit comments

Comments
 (0)