Healy-Hyperspatial / stac-fastapi-mongo

Mongodb backend for stac-fastapi built on the stac-fastapi-elasticsearch core api library.
MIT License
6 stars 1 forks source link

possible pagination-fix using mongo skip #9

Closed pedro-cf closed 7 months ago

pedro-cf commented 7 months ago

Related Issue(s):

Description:

PR Checklist:

jonhealy1 commented 7 months ago

The tests are failing because of pre-commit. If you run python -m pip install pre-commit and then pre-commit run --all-files it will either fix the issue or tell you what it is.

jonhealy1 commented 7 months ago

The other thing to do (which I haven't been doing well so far on this project but will start doing) is to update the Changelog. So like here we describe the addition or fix this pr is making and then link either the issue number of the pr number. Then when we release the next version people can read about what has changed: https://raw.githubusercontent.com/stac-utils/stac-fastapi-elasticsearch-opensearch/main/CHANGELOG.md

pedro-cf commented 7 months ago

The tests are failing because of pre-commit. If you run python -m pip install pre-commit and then pre-commit run --all-files it will either fix the issue or tell you what it is.

I've done it and it made some changes: image

I've updated the changelog but I'm unsure if this is how you are supposted to do it: https://github.com/pedro-cf/stac-fastapi-mongo/blob/pagination-fix/CHANGELOG.md

I've also unskipped the 3 pagination tests: https://github.com/pedro-cf/stac-fastapi-mongo/commit/ef8f08d90460187e01345f042eda4def0f613c17#diff-a38bef06b3f69317891c409bc81044f53cca52841ea63ec9a6821ea08dea98f6

These changes are all in this commit: https://github.com/pedro-cf/stac-fastapi-mongo/commit/ef8f08d90460187e01345f042eda4def0f613c17

but it seems the pagination tests are failing

jonhealy1 commented 7 months ago

Any new changes always go into the Unreleased section and then later we will update the version and push a new release to PyPI

jonhealy1 commented 7 months ago

I don't know why the tests are failing - I can look at it tomorrow too if you don't know either or don't have time

jonhealy1 commented 7 months ago

The tests are just copied from stac-fastapi-elasticsearch

pedro-cf commented 7 months ago

https://github.com/Healy-Hyperspatial/stac-fastapi-mongo/blob/e59c421c816abe69ced82b472e3b1b837bf6495f/stac_fastapi/tests/resources/test_item.py#L634-L648

"links": [] in page_data seems to be empty, which is causing an error. I don't quite understand where the data used for testing comes from.

{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[152.15052873427666, -33.82243006904891], [150.1000346138806, -34.257132625788756], [149.5776607193635, -32.514709769700254], [151.6262528041627, -32.08081674221862], [152.15052873427666, -33.82243006904891]]]}, "properties": {"datetime": "2020-02-12T12:30:22+00:00"}, "id": "1fa7232f-821b-4be6-8191-ea9b73414b0e", "bbox": [149.57574, -34.25796, 152.15194, -32.07915], "stac_version": "1.0.0", "assets": {"ANG": {"title": "Angle Coefficients File", "description": "Collection 2 Level-1 Angle Coefficients File (ANG)", "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ANG.txt", "type": "text/plain"}, "SR_B1": {"title": "Coastal/Aerosol Band (B1)", "description": "Collection 2 Level-2 Coastal/Aerosol Band (B1) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B1.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B1", "common_name": "coastal", "center_wavelength": 0.44, "full_width_half_max": 0.02}]}, "SR_B2": {"title": "Blue Band (B2)", "description": "Collection 2 Level-2 Blue Band (B2) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B2.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B2", "common_name": "blue", "center_wavelength": 0.48, "full_width_half_max": 0.06}]}, "SR_B3": {"title": "Green Band (B3)", "description": "Collection 2 Level-2 Green Band (B3) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B3.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B3", "common_name": "green", "center_wavelength": 0.56, "full_width_half_max": 0.06}]}, "SR_B4": {"title": "Red Band (B4)", "description": "Collection 2 Level-2 Red Band (B4) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B4.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B4", "common_name": "red", "center_wavelength": 0.65, "full_width_half_max": 0.04}]}, "SR_B5": {"title": "Near Infrared Band 0.8 (B5)", "description": "Collection 2 Level-2 Near Infrared Band 0.8 (B5) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B5.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B5", "common_name": "nir08", "center_wavelength": 0.86, "full_width_half_max": 0.03}]}, "SR_B6": {"title": "Short-wave Infrared Band 1.6 (B6)", "description": "Collection 2 Level-2 Short-wave Infrared Band 1.6 (B6) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B6.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B6", "common_name": "swir16", "center_wavelength": 1.6, "full_width_half_max": 0.08}]}, "SR_B7": {"title": "Short-wave Infrared Band 2.2 (B7)", "description": "Collection 2 Level-2 Short-wave Infrared Band 2.2 (B7) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B7.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B7", "common_name": "swir22", "center_wavelength": 2.2, "full_width_half_max": 0.2}]}, "ST_QA": {"title": "Surface Temperature Quality Assessment Band", "description": "Landsat Collection 2 Level-2 Surface Temperature Band Surface Temperature Product", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ST_QA.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591]}, "ST_B10": {"title": "Surface Temperature Band (B10)", "description": "Landsat Collection 2 Level-2 Surface Temperature Band (B10) Surface Temperature Product", "gsd": 100.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ST_B10.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 100, "name": "ST_B10", "common_name": "lwir11", "center_wavelength": 10.9, "full_width_half_max": 0.8}]}, "MTL.txt": {"title": "Product Metadata File", "description": "Collection 2 Level-1 Product Metadata File (MTL)", "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_MTL.txt", "type": "text/plain"}, "MTL.xml": {"title": "Product Metadata File (xml)", "description": "Collection 2 Level-1 Product Metadata File (xml)", "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_MTL.xml", "type": "application/xml"}, "ST_DRAD": {"title": "Downwelled Radiance Band", "description": "Landsat Collection 2 Level-2 Downwelled Radiance Band Surface Temperature Product", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ST_DRAD.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "ST_DRAD", "description": "downwelled radiance"}]}, "ST_EMIS": {"title": "Emissivity Band", "description": "Landsat Collection 2 Level-2 Emissivity Band Surface Temperature Product", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ST_EMIS.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "ST_EMIS", "description": "emissivity"}]}, "ST_EMSD": {"title": "Emissivity Standard Deviation Band", "description": "Landsat Collection 2 Level-2 Emissivity Standard Deviation Band Surface Temperature Product", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ST_EMSD.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "ST_EMSD", "description": "emissivity standard deviation"}]}}, "links": [{"href": "http://test-server/collections/test-collection/items/1fa7232f-821b-4be6-8191-ea9b73414b0e", "rel": "self", "type": "application/geo+json"}, {"href": "http://test-server/collections/test-collection", "rel": "parent", "type": "application/json"}, {"href": "http://test-server/collections/test-collection", "rel": "collection", "type": "application/json"}, {"href": "http://test-server/", "rel": "root", "type": "application/json"}], "collection": "test-collection"}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[152.15052873427666, -33.82243006904891], [150.1000346138806, -34.257132625788756], [149.5776607193635, -32.514709769700254], [151.6262528041627, -32.08081674221862], [152.15052873427666, -33.82243006904891]]]}, "properties": {"datetime": "2020-02-12T12:30:22+00:00"}, "id": "test-item", "bbox": [149.57574, -34.25796, 152.15194, -32.07915], "stac_version": "1.0.0", "assets": {"ANG": {"title": "Angle Coefficients File", "description": "Collection 2 Level-1 Angle Coefficients File (ANG)", "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ANG.txt", "type": "text/plain"}, "SR_B1": {"title": "Coastal/Aerosol Band (B1)", "description": "Collection 2 Level-2 Coastal/Aerosol Band (B1) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B1.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B1", "common_name": "coastal", "center_wavelength": 0.44, "full_width_half_max": 0.02}]}, "SR_B2": {"title": "Blue Band (B2)", "description": "Collection 2 Level-2 Blue Band (B2) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B2.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B2", "common_name": "blue", "center_wavelength": 0.48, "full_width_half_max": 0.06}]}, "SR_B3": {"title": "Green Band (B3)", "description": "Collection 2 Level-2 Green Band (B3) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B3.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B3", "common_name": "green", "center_wavelength": 0.56, "full_width_half_max": 0.06}]}, "SR_B4": {"title": "Red Band (B4)", "description": "Collection 2 Level-2 Red Band (B4) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B4.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B4", "common_name": "red", "center_wavelength": 0.65, "full_width_half_max": 0.04}]}, "SR_B5": {"title": "Near Infrared Band 0.8 (B5)", "description": "Collection 2 Level-2 Near Infrared Band 0.8 (B5) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B5.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B5", "common_name": "nir08", "center_wavelength": 0.86, "full_width_half_max": 0.03}]}, "SR_B6": {"title": "Short-wave Infrared Band 1.6 (B6)", "description": "Collection 2 Level-2 Short-wave Infrared Band 1.6 (B6) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B6.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B6", "common_name": "swir16", "center_wavelength": 1.6, "full_width_half_max": 0.08}]}, "SR_B7": {"title": "Short-wave Infrared Band 2.2 (B7)", "description": "Collection 2 Level-2 Short-wave Infrared Band 2.2 (B7) Surface Reflectance", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_SR_B7.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "SR_B7", "common_name": "swir22", "center_wavelength": 2.2, "full_width_half_max": 0.2}]}, "ST_QA": {"title": "Surface Temperature Quality Assessment Band", "description": "Landsat Collection 2 Level-2 Surface Temperature Band Surface Temperature Product", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ST_QA.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591]}, "ST_B10": {"title": "Surface Temperature Band (B10)", "description": "Landsat Collection 2 Level-2 Surface Temperature Band (B10) Surface Temperature Product", "gsd": 100.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ST_B10.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 100, "name": "ST_B10", "common_name": "lwir11", "center_wavelength": 10.9, "full_width_half_max": 0.8}]}, "MTL.txt": {"title": "Product Metadata File", "description": "Collection 2 Level-1 Product Metadata File (MTL)", "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_MTL.txt", "type": "text/plain"}, "MTL.xml": {"title": "Product Metadata File (xml)", "description": "Collection 2 Level-1 Product Metadata File (xml)", "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_MTL.xml", "type": "application/xml"}, "ST_DRAD": {"title": "Downwelled Radiance Band", "description": "Landsat Collection 2 Level-2 Downwelled Radiance Band Surface Temperature Product", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ST_DRAD.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "ST_DRAD", "description": "downwelled radiance"}]}, "ST_EMIS": {"title": "Emissivity Band", "description": "Landsat Collection 2 Level-2 Emissivity Band Surface Temperature Product", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ST_EMIS.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "ST_EMIS", "description": "emissivity"}]}, "ST_EMSD": {"title": "Emissivity Standard Deviation Band", "description": "Landsat Collection 2 Level-2 Emissivity Standard Deviation Band Surface Temperature Product", "gsd": 30.0, "href": "https://landsateuwest.blob.core.windows.net/landsat-c2/level-2/standard/oli-tirs/2021/108/066/LC08_L2SP_108066_20210712_20210720_02_T1/LC08_L2SP_108066_20210712_20210720_02_T1_ST_EMSD.TIF", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "proj:transform": [30, 0, 304185, 0, -30, -843585], "proj:shape": [7731, 7591], "eo:bands": [{"gsd": 30, "name": "ST_EMSD", "description": "emissivity standard deviation"}]}}, "links": [{"href": "http://test-server/collections/test-collection/items/test-item", "rel": "self", "type": "application/geo+json"}, {"href": "http://test-server/collections/test-collection", "rel": "parent", "type": "application/json"}, {"href": "http://test-server/collections/test-collection", "rel": "collection", "type": "application/json"}, {"href": "http://test-server/", "rel": "root", "type": "application/json"}], "collection": "test-collection"}], "links": [], "context": {"returned": 2, "limit": 3, "matched": 2}}

Also I'm running these tests by:

docker-compose up -d mongo app-mongo
docker exec -it stac-fastapi-mongo bash
make test

Not sure if it's the correct way.

jonhealy1 commented 7 months ago

This is how I run the tests too - docker exec into the container. It definitely seems weird that links is empty. Could be a problem somewhere else.

jonhealy1 commented 7 months ago

Here it says ingest 5 items but the items are being created outside of the loop?


     for _ in range(5): 
         ctx.item["id"] = str(uuid.uuid4()) 
     await create_item(txn_client, ctx.item) 
     ids.append(ctx.item["id"])```
pedro-cf commented 7 months ago

I've made fixes to the 3 pytests: https://github.com/pedro-cf/stac-fastapi-mongo/commit/a32d1fe4adf89ed0f77412f39f6060dbff1af98b

Here it says ingest 5 items but the items are being created outside of the loop?

     for _ in range(5): 
         ctx.item["id"] = str(uuid.uuid4()) 
     await create_item(txn_client, ctx.item) 
     ids.append(ctx.item["id"])```

1. test_pagination_token_idempotent

2. test_pagination_post

3. test_pagination_item_collection

jonhealy1 commented 7 months ago

Nice catches. Did that help any of the tests pass? You have to run pre-commit run --all-files again. It's something I almost always forget too.

pedro-cf commented 7 months ago

Nice work! Thank you.

I think test_pagination_item_collection and test_pagination_post still need some rework because the logic doesn't seem right

pedro-cf commented 7 months ago

I improved the tests: better variable naming; comments for clarity; code improve

tests seem to run ok

image

jonhealy1 commented 7 months ago

Sort of weird these test pass on stac-fastapi-elasticsearch.... They probably need to be fixed there too

pedro-cf commented 7 months ago

Sort of weird these test pass on stac-fastapi-elasticsearch.... They probably need to be fixed there too

I'm not 100% sure I'm correct... but perhaps you could take a look at my tests?

But for example, in the original test_pagination_item_collection:

https://github.com/Healy-Hyperspatial/stac-fastapi-mongo/blob/e59c421c816abe69ced82b472e3b1b837bf6495f/stac_fastapi/tests/resources/test_item.py#L570

Why would we expect 7 requests for 6 items ? Perhaps that's how elasticsearch works ?

https://github.com/Healy-Hyperspatial/stac-fastapi-mongo/blob/e59c421c816abe69ced82b472e3b1b837bf6495f/stac_fastapi/tests/resources/test_item.py#L560-L593