Skip to content

Commit

Permalink
Merge branch 'develop' into 129-arbitrary-parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Drew Meyers committed Sep 17, 2024
2 parents d44b976 + d0a42e3 commit 3f993bb
Show file tree
Hide file tree
Showing 8 changed files with 719 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Unit Tests

on: [pull_request]
on:
pull_request:
workflow_dispatch:

jobs:
unit-tests:
Expand Down
17 changes: 12 additions & 5 deletions unity-test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import glob
import json
import os
import pathlib
import re

import fakeredis
Expand Down Expand Up @@ -28,6 +30,11 @@
Base.metadata.create_all(bind=engine)


TEST_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_data")
PROCESS_FILES = glob.glob(f"{TEST_DIR}/process_descriptions/*.json")
EXECUTION_FILES = glob.glob(f"{TEST_DIR}/execution_requests/*.json")


def override_get_db():
try:
db = TestingSessionLocal()
Expand Down Expand Up @@ -64,6 +71,7 @@ def fake_filesystem(fs_session, test_directory): # pylint:disable=invalid-name
contents="test",
)
fs_session.create_file(os.path.join(settings.DAG_CATALOG_DIRECTORY, "EchoProcess.py"), contents="test")
fs_session.create_file(os.path.join(settings.DAG_CATALOG_DIRECTORY, "cwl_dag.py"), contents="test")
fs_session.create_dir(settings.DEPLOYED_DAGS_DIRECTORY)
yield fs_session

Expand Down Expand Up @@ -449,17 +457,16 @@ def mock_patch_existing_running_dag_dagrun_task(requests_mock):
)


@pytest.fixture(scope="function")
def deploy_process(test_directory, client):
data_filename = os.path.join(test_directory, "..", "process_descriptions", "cwltool_help_dag.json")
f = open(data_filename)
@pytest.fixture(scope="function", params=PROCESS_FILES)
def deploy_process(test_directory, client, request):
f = open(request.param)
process_json = json.load(f)
process = Process.model_validate(process_json)
response = client.post("/processes", json=process.model_dump())
assert response.status_code == status.HTTP_200_OK
data = response.json()
process = Process.model_validate(data)
assert process.id == "cwltool_help_dag"
assert process.id == pathlib.Path(request.param).stem

yield process

Expand Down
12 changes: 12 additions & 0 deletions unity-test/test_data/execution_requests/cwl_dag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"inputs": {
"complexObjectInput": {
"value": {
"message": "Hello Unity"
}
}
},
"outputs": {
"stringOutput": {}
}
}
120 changes: 120 additions & 0 deletions unity-test/test_data/execution_requests/cwltool_help_dag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"inputs": {
"arrayInput": [
1,
2,
3,
4,
5,
6
],
"boundingBoxInput": {
"bbox": [
51.9,
7,
52,
7.1
],
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"complexObjectInput": {
"value": {
"property1": "value1",
"property2": "value2",
"property5": true
}
},
"dateInput": "2021-03-06T07:21:00",
"doubleInput": 3.14159,
"featureCollectionInput": {
"mediaType": "application/gml+xml; version=3.2",
"value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><FeatureCollection xmlns=\"http://schemas.myserver.com/namespaces/null\" xmlns:gml=\"http://www.opengis.net/gml/3.2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://schemas.myserver.com/namespaces/null https://www.pvretano.com/myserver/ogcapi/daraa/schema?f=GML32&amp;collectionids=TransportationGroundCrv http://www.opengis.net/gml/3.2 http://schemas.opengis.net/schemas/gml/3.2.1/gml.xsd\">..."
},
"geometryInput": [
{
"mediaType": "application/gml+xml; version=3.2",
"value": "<gml:Polygon gml:id=\"GID1\" srsName=\"urn:ogc:def:crs:OGC::CRS84\"><gml:exterior><gml:LinearRing><gml:posList>-77.024519 38.810529 -77.024635 38.810973 -77.024704 38.810962 -77.024776 38.811239 -77.024957 38.81121 -77.024905 38.811012 -77.024905 38.811012 -77.024865 38.810857 -77.025024 38.810832 -77.025071 38.811012 -77.025203 38.810992 -77.02506 38.810444 -77.024519 38.810529</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon>"
},
{
"value": {
"coordinates": [
[
[
-176.5814819,
-44.10896301
],
[
-176.5818024,
-44.10964584
],
[
-176.5844116,
-44.11236572
],
[
-176.5935974,
-44.11021805
],
[
-176.5973511,
-44.10743332
],
[
-176.5950928,
-44.10562134
],
[
-176.5858459,
-44.1043396
],
[
-176.5811157,
-44.10667801
],
[
-176.5814819,
-44.10896301
]
]
],
"type": "Polygon"
}
}
],
"imagesInput": [
{
"href": "https://www.someserver.com/ogcapi/Daraa/collections/Daraa_DTED/styles/Topographic/coverage?...",
"type": "image/tiff; application=geotiff"
},
{
"encoding": "base64",
"mediaType": "image/jp2",
"value": "VBORw0KGgoAAAANSUhEUgAABvwAAAa4CAYAAABMB35kAAABhGlDQ1BJQ0MgcHJvZmlsZQAA\nKJF9kT1Iw0AcxV9TpSL1A+xQxCFDdbIgKuKoVShChVArtOpgcumH0KQhSXFxFFwLDn4sVh1c\nnHV1cBUEwQ8QNzcnRRcp8X9JoUWMB8f9eHfvcfcOEOplplkdY4Cm22Y6mRCzuRUx9IogouhH\n ... \nj3Z5mX7/PCPVRJV92rpHK24xcJrzk20+tkeYlCPqcZNO3Lpni1OJWatPCcmgGDEqx7Om6lfa\nppM4k4BTe9+bsn3L9/9/yWhA0PwQGW8ipCZsnZt9lsdrYEM8z/M8z/M8z/M8z/M8z/MzLWY1\nAAAACUlEQVQ871H6P6JI+TxS5Wn2AAAAAElFTkSuQmCC"
}
],
"measureInput": {
"value": {
"measurement": 10.3,
"reference": "https://ucum.org/ucum-essence.xml",
"uom": "m"
}
},
"stringInput": "Value2"
},
"outputs": {
"arrayOutput": {},
"boundingBoxOutput": {},
"complexObjectOutput": {},
"dateOutput": {},
"doubleOutput": {},
"featureCollectionOutput": {},
"geometryOutput": {},
"imageOutput": {
"format": {
"mediaType": "image/tiff; application=geotiff"
}
},
"measureOutput": {},
"stringOutput": {}
}
}
48 changes: 48 additions & 0 deletions unity-test/test_data/process_descriptions/cwl_dag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"description": "This process accepts string input and echoes the input as a string output.",
"id": "cwl_dag",
"inputs": [
{
"complexObjectInput": {
"description": "Excepts a string under message property.",
"schema": {
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
],
"type": "object"
},
"title": "Input object"
}
}
],
"jobControlOptions": [
"async-execute",
"sync-execute"
],
"links": [
{
"href": "https://processing.example.org/oapi-p/processes/CWGDAGProcess/execution",
"rel": "http://www.opengis.net/def/rel/ogc/1.0/execute",
"title": "Execute endpoint"
}
],
"outputs": [
{
"stringOutput": {
"schema": {
"enum": [
"Output string value"
],
"type": "string"
}
}
}
],
"title": "CWL DAG Process",
"version": "1.0.0"
}
Loading

0 comments on commit 3f993bb

Please sign in to comment.