Build a test suite that uses known items via a test fixture
Rationale
The STAC service works, and exposes a range of search features. We need reproducible and specific information about each feature to assert that everything works correctly. Ideally, we want:
Unit tests
Documentation
Example Notebook(s)
To test properly, we should create a developer environment that includes all components:
ElasticSearch service (with some known content)
STAC FastAPI ElasticSearch service
Pystac client
How can we ensure the tests work when the index contents change?
We can make the tests robust if we:
Define a known set of items (by their file paths/directories)
Create a script/tool to extract those items from a given service endpoint
Also extract the relevant asset and collection records in relation to those items
Write tests against the known contents and structure of those items and assets.
Task list
[x] Define and test a devcontainer that contains: ElasticSearch, STAC FastAPI ElasticSearch, Pystac client, (and esgf-stac-client)
[x] Work with Sam/Ag to identify a set of appropriate items to work with:
At least 1 item from these collections: badc, cmip5, eprof_daily, faam, neodc, sentinel1a, sentinel5p, ukmo-rad-hires
[x] Write a script to extract the items identified above:
Script should read from user-defined STAC Search Service (probably current production service)
For each item, also extract the related assets and collection
Serialise to JSON, or zipped JSON.
NOTE: script will be re-used in future so ensure it is part of the test codebase
[x] Write a script to load the JSON (from above) into the local test ElasticSearch service
[ ] For each feature in the API docs, we want to ....
Tests will use the known test fixture to make sure that the functions of the search API are working correctly, e.g.:
A known temporal and spatial request will only return one FAAM flight
A known combination of facets will match 2 known CMIP6 records
Write the code/tests in one place:
Parse to generate:
Notebook(s)
Unit test(s)
Documentation
Assets are all correct based on Item:
E.g. correct list
No duplicates, etc.
Build a test suite that uses known items via a test fixture
Rationale
The STAC service works, and exposes a range of search features. We need reproducible and specific information about each feature to assert that everything works correctly. Ideally, we want:
To test properly, we should create a developer environment that includes all components:
How can we ensure the tests work when the index contents change?
We can make the tests robust if we:
items
(by their file paths/directories)items
from a given service endpointasset
andcollection
records in relation to thoseitems
items
andassets
.Task list
devcontainer
that contains: ElasticSearch, STAC FastAPI ElasticSearch, Pystac client, (and esgf-stac-client)items
to work with:item
from these collections:badc, cmip5, eprof_daily, faam, neodc, sentinel1a, sentinel5p, ukmo-rad-hires
items
identified above:assets
andcollection
Tests will use the known test fixture to make sure that the functions of the search API are working correctly, e.g.: A known temporal and spatial request will only return one FAAM flight A known combination of facets will match 2 known CMIP6 records Write the code/tests in one place: Parse to generate: Notebook(s) Unit test(s) Documentation Assets are all correct based on Item: E.g. correct list No duplicates, etc.