Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding all WDL unit tests to API pytests #102

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions WildcardsandConditions/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"workflow_failure_mode": "ContinueWhilePossible",
"write_to_cache": false,
"read_from_cache": false
}
5 changes: 5 additions & 0 deletions badRunParseBatchFile/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"workflow_failure_mode": "ContinueWhilePossible",
"write_to_cache": false,
"read_from_cache": false
}
5 changes: 5 additions & 0 deletions badValMissingValue/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"workflow_failure_mode": "ContinueWhilePossible",
"write_to_cache": false,
"read_from_cache": false
}
4 changes: 2 additions & 2 deletions basicTaskExecution/basicTaskExecution.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ task simpleTask {
}

command <<<
echo "${message}" > output.txt
>>>
echo "~{message}" > output.txt
>>>

output {
File outputFile = "output.txt"
Expand Down
5 changes: 5 additions & 0 deletions basicTaskExecution/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"workflow_failure_mode": "ContinueWhilePossible",
"write_to_cache": false,
"read_from_cache": false
}
5 changes: 5 additions & 0 deletions testFileoperations/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"workflow_failure_mode": "ContinueWhilePossible",
"write_to_cache": false,
"read_from_cache": false
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,54 @@
interactions:
- request:
body: "--a140cd8d08d737fbd07610f0ad944f32\r\nContent-Disposition: form-data; name=\"workflowSource\";
body: "--f947081d17ca51d9ce53dfa7ea9ff40f\r\nContent-Disposition: form-data; name=\"workflowSource\";
filename=\"helloDockerHostname.wdl\"\r\nContent-Type: application/octet-stream\r\n\r\nversion
1.0\n## This is a test workflow that returns the hostname of the node \n## the
job is submitted to as a test for Docker functionality on Gizmo.\n\n#### WORKFLOW
DEFINITION\n\nworkflow HelloDockerHostname {\n call Hostname {\n }\n\n output
{\n File stdout = Hostname.out\n }\n\n parameter_meta {\n stdout: \"hostname
of the node the job was submitted to\"\n }\n}\n\n#### TASK DEFINITIONS\n\ntask
Hostname {\n command <<<\n echo $(hostname)\n >>>\n\n output {\n File
out = stdout()\n }\n\n runtime {\n cpu: 1\n memory: \"1 GB\"\n docker:
\"ubuntu:latest\"\n }\n\n parameter_meta {\n out: \"hostname of the node
the job was submitted to\"\n }\n}\n\r\n--a140cd8d08d737fbd07610f0ad944f32\r\nContent-Disposition:
1.0\n## This is a test workflow that returns the Docker image name and tag\n##
and measures execution time of the Hostname task.\n\n#### WORKFLOW DEFINITION\n\nworkflow
HelloDockerHostname {\n input {\n String docker_image = \"ubuntu:20.04\"
\ # Default value but can be overridden\n }\n\n call GetStartTime\n\n call
Hostname {\n input:\n expected_image = docker_image,\n start_time
= GetStartTime.timestamp # Add dependency on start time\n }\n\n call GetEndTime
{\n input:\n hostname_done = Hostname.out # Add dependency on Hostname
completion\n }\n\n call ValidateExecutionTime {\n input:\n start_time
= GetStartTime.timestamp,\n end_time = GetEndTime.timestamp\n }\n\n output
{\n File stdout = Hostname.out\n Float execution_time_seconds = ValidateExecutionTime.duration_seconds\n
\ Boolean within_time_limit = ValidateExecutionTime.within_limit\n }\n\n
\ parameter_meta {\n docker_image: \"Docker image to run the task in (e.g.
ubuntu:latest)\"\n }\n}\n\n#### TASK DEFINITIONS\n\ntask GetStartTime {\n command
<<<\n date +%s.%N\n >>>\n\n output {\n Float timestamp = read_float(stdout())\n
\ }\n\n runtime {\n docker: \"ubuntu:20.04\"\n cpu: 1\n memory: \"1
GB\"\n }\n}\n\ntask GetEndTime {\n input {\n File hostname_done # Add
dependency on Hostname completion\n }\n\n command <<<\n date +%s.%N\n >>>\n\n
\ output {\n Float timestamp = read_float(stdout())\n }\n\n runtime {\n
\ docker: \"ubuntu:20.04\"\n cpu: 1\n memory: \"1 GB\"\n }\n}\n\ntask
ValidateExecutionTime {\n input {\n Float start_time\n Float end_time\n
\ }\n\n command <<<\n # Calculate duration using awk for floating point
arithmetic\n duration=$(awk \"BEGIN {print ~{end_time} - ~{start_time}}\")\n
\ echo \"$duration\" > duration.txt\n \n # Check if duration is less
than 120 seconds (2 minutes)\n awk -v dur=\"$duration\" 'BEGIN {if (dur <
120) exit 0; exit 1}'\n if [ $? -eq 0 ]; then\n echo \"true\" > within_limit.txt\n
\ else\n echo \"false\" > within_limit.txt\n fi\n >>>\n\n output
{\n Float duration_seconds = read_float(\"duration.txt\")\n Boolean within_limit
= read_boolean(\"within_limit.txt\")\n }\n\n runtime {\n docker: \"ubuntu:20.04\"\n
\ cpu: 1\n memory: \"1 GB\"\n }\n}\n\ntask Hostname {\n input {\n String
expected_image\n Float start_time # Add start_time as input to create dependency\n
\ }\n\n command <<<\n # Split expected image into name and tag\n EXPECTED_IMAGE_NAME=$(echo
\"~{expected_image}\" | cut -d':' -f1)\n EXPECTED_TAG=$(echo \"~{expected_image}\"
| cut -d':' -f2)\n\n # Get current image info\n CURRENT_IMAGE=$(grep \"ID=\"
/etc/os-release | head -n1 | cut -d'=' -f2)\n CURRENT_VERSION=$(grep \"VERSION_ID=\"
/etc/os-release | cut -d'\"' -f2)\n\n # Compare image name\n if [[ \"$CURRENT_IMAGE\"
!= \"$EXPECTED_IMAGE_NAME\" ]]; then\n echo \"Error: Expected Docker image
$EXPECTED_IMAGE_NAME but got: $CURRENT_IMAGE\"\n exit 1\n fi\n\n #
Compare version/tag\n if [[ \"$CURRENT_VERSION\" != \"$EXPECTED_TAG\" ]];
then\n echo \"Error: Expected version $EXPECTED_TAG but got: $CURRENT_VERSION\"\n
\ exit 1\n fi\n\n echo \"Verified Docker Image: $CURRENT_IMAGE:$CURRENT_VERSION\"\n
\ echo \"Expected Image: ~{expected_image}\"\n echo \"Hostname: $(hostname)\"\n
\ >>>\n\n output {\n File out = stdout()\n }\n\n runtime {\n cpu: 1\n
\ memory: \"1 GB\"\n docker: \"~{expected_image}\"\n }\n\n parameter_meta
{\n expected_image: \"Docker image that should be running this task\"\n }\n}\n\r\n--f947081d17ca51d9ce53dfa7ea9ff40f\r\nContent-Disposition:
form-data; name=\"workflowOptions\"; filename=\"options.json\"\r\nContent-Type:
application/json\r\n\r\n{\n \"workflow_failure_mode\": \"ContinueWhilePossible\",\n
\ \"write_to_cache\": false,\n \"read_from_cache\": false\n}\n\r\n--a140cd8d08d737fbd07610f0ad944f32--\r\n"
\ \"write_to_cache\": false,\n \"read_from_cache\": false\n}\n\r\n--f947081d17ca51d9ce53dfa7ea9ff40f--\r\n"
headers:
accept:
- '*/*'
Expand All @@ -22,18 +57,18 @@ interactions:
connection:
- keep-alive
content-length:
- '1120'
- '3904'
content-type:
- multipart/form-data; boundary=a140cd8d08d737fbd07610f0ad944f32
- multipart/form-data; boundary=f947081d17ca51d9ce53dfa7ea9ff40f
host:
- gizmok96.fhcrc.org:38031
- gizmoj32.fhcrc.org:35541
user-agent:
- python-httpx/0.28.1
method: POST
uri: https://gizmok96.fhcrc.org:38031/api/workflows/v1
uri: https://gizmoj32.fhcrc.org:35541/api/workflows/v1
response:
body:
string: '{"id":"8c838f7b-f771-4cc5-94bc-a509f26dbcf0","status":"Submitted"}'
string: '{"id":"bd701a72-0f44-4305-a287-a4f389b79608","status":"Submitted"}'
headers:
Connection:
- keep-alive
Expand All @@ -42,7 +77,7 @@ interactions:
Content-Type:
- application/json
Date:
- Tue, 28 Jan 2025 19:20:42 GMT
- Tue, 11 Feb 2025 07:38:44 GMT
Server:
- nginx/1.25.3
status:
Expand All @@ -60,14 +95,14 @@ interactions:
content-length:
- '0'
host:
- gizmok96.fhcrc.org:38031
- gizmoj32.fhcrc.org:35541
user-agent:
- python-httpx/0.28.1
method: POST
uri: https://gizmok96.fhcrc.org:38031/api/workflows/v1/8c838f7b-f771-4cc5-94bc-a509f26dbcf0/abort
uri: https://gizmoj32.fhcrc.org:35541/api/workflows/v1/bd701a72-0f44-4305-a287-a4f389b79608/abort
response:
body:
string: '{"id":"8c838f7b-f771-4cc5-94bc-a509f26dbcf0","status":"Aborted"}'
string: '{"id":"bd701a72-0f44-4305-a287-a4f389b79608","status":"Aborted"}'
headers:
Connection:
- keep-alive
Expand All @@ -76,7 +111,7 @@ interactions:
Content-Type:
- application/json
Date:
- Tue, 28 Jan 2025 19:20:42 GMT
- Tue, 11 Feb 2025 07:38:44 GMT
Server:
- nginx/1.25.3
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interactions:
- request:
body: "--35d29ba0213e6a30bee8707a58c65735\r\nContent-Disposition: form-data; name=\"workflowSource\";
body: "--eba35b3a333a10d4292171ad0ec20510\r\nContent-Disposition: form-data; name=\"workflowSource\";
filename=\"helloHostname.wdl\"\r\nContent-Type: application/octet-stream\r\n\r\nversion
1.0\n## This is a test workflow that returns the hostname of the node \n## the
job is submitted to as a test for the Gizmo backend. \n\n#### WORKFLOW DEFINITION\n\nworkflow
Expand All @@ -9,10 +9,10 @@ interactions:
to\"\n }\n}\n\n#### TASK DEFINITIONS\n\ntask Hostname {\n command <<<\n echo
$(hostname)\n >>>\n\n output {\n File out = stdout()\n }\n \n runtime
{\n cpu: 1\n memory: \"1 GB\"\n }\n\n parameter_meta {\n out: \"hostname
of the node the job was submitted to\"\n }\n}\n\r\n--35d29ba0213e6a30bee8707a58c65735\r\nContent-Disposition:
of the node the job was submitted to\"\n }\n}\n\r\n--eba35b3a333a10d4292171ad0ec20510\r\nContent-Disposition:
form-data; name=\"workflowOptions\"; filename=\"options.json\"\r\nContent-Type:
application/json\r\n\r\n{\n \"workflow_failure_mode\": \"ContinueWhilePossible\",\n
\ \"write_to_cache\": false,\n \"read_from_cache\": false\n}\n\r\n--35d29ba0213e6a30bee8707a58c65735--\r\n"
\ \"write_to_cache\": false,\n \"read_from_cache\": false\n}\n\r\n--eba35b3a333a10d4292171ad0ec20510--\r\n"
headers:
accept:
- '*/*'
Expand All @@ -23,16 +23,16 @@ interactions:
content-length:
- '1071'
content-type:
- multipart/form-data; boundary=35d29ba0213e6a30bee8707a58c65735
- multipart/form-data; boundary=eba35b3a333a10d4292171ad0ec20510
host:
- gizmok96.fhcrc.org:38031
- gizmoj32.fhcrc.org:35541
user-agent:
- python-httpx/0.28.1
method: POST
uri: https://gizmok96.fhcrc.org:38031/api/workflows/v1
uri: https://gizmoj32.fhcrc.org:35541/api/workflows/v1
response:
body:
string: '{"id":"ec04a1f3-7ae5-4ab9-9b96-44ccd289d02e","status":"Submitted"}'
string: '{"id":"5b7becef-b90a-4286-8901-068785a631db","status":"Submitted"}'
headers:
Connection:
- keep-alive
Expand All @@ -41,7 +41,7 @@ interactions:
Content-Type:
- application/json
Date:
- Tue, 28 Jan 2025 19:20:42 GMT
- Tue, 11 Feb 2025 07:38:44 GMT
Server:
- nginx/1.25.3
status:
Expand All @@ -59,14 +59,14 @@ interactions:
content-length:
- '0'
host:
- gizmok96.fhcrc.org:38031
- gizmoj32.fhcrc.org:35541
user-agent:
- python-httpx/0.28.1
method: POST
uri: https://gizmok96.fhcrc.org:38031/api/workflows/v1/ec04a1f3-7ae5-4ab9-9b96-44ccd289d02e/abort
uri: https://gizmoj32.fhcrc.org:35541/api/workflows/v1/5b7becef-b90a-4286-8901-068785a631db/abort
response:
body:
string: '{"id":"ec04a1f3-7ae5-4ab9-9b96-44ccd289d02e","status":"Aborted"}'
string: '{"id":"5b7becef-b90a-4286-8901-068785a631db","status":"Aborted"}'
headers:
Connection:
- keep-alive
Expand All @@ -75,7 +75,7 @@ interactions:
Content-Type:
- application/json
Date:
- Tue, 28 Jan 2025 19:20:42 GMT
- Tue, 11 Feb 2025 07:38:44 GMT
Server:
- nginx/1.25.3
status:
Expand Down
Loading
Loading