Wire up the existing resource-discovery notebook to the system test framework. We already have this working for OpenEO, need the same pattern for Resource Discovery (in the branch parameterised-notebook-tests https://github.com/EOEPCA/system-test/tree/parameterised-notebook-tests)
How it works
The system tests use papermill to execute Jupyter notebooks and extract test results. This part is already working, so the intention will be to reuse this existing flow but for the Resource Discovery Building Block:
- Notebook cells have a comment on the first line like
# endpoint_collections or # verify_ingestion https://github.com/EOEPCA/deployment-guide/blob/main/notebooks/examples/openeo/openeo.ipynb
wrap_cells.py has a custom ExecutePreprocessor that detects these comments and wraps the cell in with test_cell('endpoint_collections'): https://github.com/EOEPCA/system-test/blob/parameterised-notebook-tests/test/wrap_cells.py
test_cell (in helpers.py) is a context manager that catches success/failure and logs to a test_results dict https://github.com/EOEPCA/deployment-guide/blob/main/notebooks/examples/modules/helpers.py
- End of notebook dumps
test_results to a JSON file see end of openeo notebook
- pytest reads that JSON and has individual test functions that assert on each result https://github.com/EOEPCA/system-test/blob/parameterised-notebook-tests/test/openeo/test_openeo.py#L56
Please see the openeo example for it working (copied from links above):
What needs doing
Two repos involved:
*1. deployment-guide repo: https://github.com/EOEPCA/deployment-guide/tree/main/notebooks/examples/resource-discovery
# Parameters
resource_discovery_domain = "https://resource-catalogue.develop.eoepca.org"
log_output_file = "resource_discovery_log.json"
- Add the JSON dump at the end of the notebook:
if test_results:
for test, result in test_results.items():
print(f"{test}: {result['status']} - {result['message']}")
json.dump(test_results, open(log_output_file, "w"), indent=2)
2. system-test repo (this repo):
- Create
test/resource-discovery/__init__.py
- Create
test/resource-discovery/test_resource_discovery.py following the pattern in test/openeo/test_openeo.py
The pytest file should:
Acceptance Criteria:
- Resource discovery notebook has
# test_name markers on key cells
- pytest wrapper exists in system-test repo
- Running the test executes the notebook and reports pass/fail for each tagged cell
Wire up the existing resource-discovery notebook to the system test framework. We already have this working for OpenEO, need the same pattern for Resource Discovery (in the branch
parameterised-notebook-testshttps://github.com/EOEPCA/system-test/tree/parameterised-notebook-tests)How it works
The system tests use papermill to execute Jupyter notebooks and extract test results. This part is already working, so the intention will be to reuse this existing flow but for the Resource Discovery Building Block:
# endpoint_collectionsor# verify_ingestionhttps://github.com/EOEPCA/deployment-guide/blob/main/notebooks/examples/openeo/openeo.ipynbwrap_cells.pyhas a customExecutePreprocessorthat detects these comments and wraps the cell inwith test_cell('endpoint_collections'):https://github.com/EOEPCA/system-test/blob/parameterised-notebook-tests/test/wrap_cells.pytest_cell(inhelpers.py) is a context manager that catches success/failure and logs to atest_resultsdict https://github.com/EOEPCA/deployment-guide/blob/main/notebooks/examples/modules/helpers.pytest_resultsto a JSON file see end of openeo notebookPlease see the openeo example for it working (copied from links above):
What needs doing
Two repos involved:
*1. deployment-guide repo: https://github.com/EOEPCA/deployment-guide/tree/main/notebooks/examples/resource-discovery
Add
# test_namecomments to the first line of cells that should be tested i.e.# endpoint_landing_page.Add papermill parameters near the top (these get injected at runtime):
2. system-test repo (this repo):
test/resource-discovery/__init__.pytest/resource-discovery/test_resource_discovery.pyfollowing the pattern intest/openeo/test_openeo.pyThe pytest file should:
execute_wrapped_notebook()fromrun_notebook.py(https://github.com/EOEPCA/system-test/blob/parameterised-notebook-tests/test/run_notebook.py)Acceptance Criteria:
# test_namemarkers on key cells