Skip to content

Commit

Permalink
Better error when collections across separate backends #153
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Sep 23, 2024
1 parent 9b65520 commit 9678262
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/openeo_aggregator/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ def get_backend_candidates_for_collections(self, collections: Iterable[str]) ->
only_on = [
f"{cid!r} only on {list(backends)}"
for cid, backends in collection_backends_map.items()
if cid in collections
if union.difference(backends)
]
raise BackendLookupFailureException(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,11 +1063,11 @@ def test_get_all_metadata_common_collections_merging(self, catalog, backend1, ba
def test_get_best_backend_for_collections_basic(self, catalog, backend1, backend2, requests_mock):
requests_mock.get(
backend1 + "/collections",
json={"collections": [{"id": "S3"}, {"id": "S4"}]},
json={"collections": [{"id": "S3"}, {"id": "S4"}, {"id": "S666"}]},
)
requests_mock.get(
backend2 + "/collections",
json={"collections": [{"id": "S4"}, {"id": "S5"}]},
json={"collections": [{"id": "S4"}, {"id": "S5"}, {"id": "S777"}]},
)
with pytest.raises(OpenEOApiException, match="Empty collection set given"):
catalog.get_backend_candidates_for_collections([])
Expand Down

0 comments on commit 9678262

Please sign in to comment.