-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
13 changed files
with
151 additions
and
13 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
centaur/src/main/resources/standardTestCases/gcpbatch_google_labels_bad.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: gcpbatch_google_labels_bad | ||
testFormat: workflowfailure | ||
backends: [GCPBATCH] | ||
|
||
files { | ||
workflow: google_labels/google_labels.wdl | ||
options: google_labels/gcpbatch_bad_options.json | ||
} | ||
|
||
metadata { | ||
workflowName: google_labels | ||
status: Failed | ||
|
||
"failures.0.message": "Invalid 'google_labels' in workflow options" | ||
"failures.0.causedBy.0.message": "Invalid label key field: `custom-label-label-label-label-label-label-label-label-label-label` is 66 characters. The maximum is 63." | ||
"failures.0.causedBy.1.message": "Invalid label value field: `Custom-Value!!!` did not match the regex '[a-z0-9]([-a-z_0-9]*[a-z0-9])?'" | ||
} |
17 changes: 17 additions & 0 deletions
17
centaur/src/main/resources/standardTestCases/gcpbatch_google_labels_good.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: gcpbatch_google_labels_good | ||
testFormat: workflowsuccess | ||
backends: [GCPBATCH] | ||
|
||
files { | ||
workflow: google_labels/gcpbatch_google_labels.wdl | ||
options: google_labels/good_options.json | ||
} | ||
|
||
metadata { | ||
workflowName: google_labels | ||
status: Succeeded | ||
|
||
"calls.google_labels.check_labels.labels.wdl-task-name": "check_labels" | ||
|
||
"calls.google_labels.check_labels.backendLabels.custom-label": "custom-value" | ||
} |
16 changes: 16 additions & 0 deletions
16
centaur/src/main/resources/standardTestCases/gcpbatch_google_labels_subworkflows.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: gcpbatch_google_labels_sub | ||
testFormat: workflowsuccess | ||
backends: [GCPBATCH] | ||
|
||
files { | ||
workflow: google_labels/gcpbatch_wrapper.wdl | ||
options: google_labels/good_options.json | ||
imports: [ | ||
google_labels/google_labels.wdl | ||
] | ||
} | ||
|
||
metadata { | ||
workflowName: google_labels_wrapper | ||
status: Succeeded | ||
} |
20 changes: 20 additions & 0 deletions
20
centaur/src/main/resources/standardTestCases/gcpbatch_jes_labels.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: gcpbatch_jes_labels | ||
testFormat: workflowsuccess | ||
tags: [ labels ] | ||
backends: [GCPBATCH] | ||
|
||
files { | ||
workflow: labels/jes_labels.wdl | ||
labels: labels/valid.labels | ||
} | ||
|
||
metadata { | ||
workflowName: I_hope_nobody_names_workflows_like_this_as_it_seems_very_unnecessary_ | ||
status: Succeeded | ||
"calls.I_hope_nobody_names_workflows_like_this_as_it_seems_very_unnecessary_.my_task_aliased.backendLabels.cromwell-workflow-id": "cromwell-<<UUID>>" | ||
"calls.I_hope_nobody_names_workflows_like_this_as_it_seems_very_unnecessary_.my_task_aliased.backendLabels.wdl-task-name": "my_task" | ||
"calls.I_hope_nobody_names_workflows_like_this_as_it_seems_very_unnecessary_.my_task_aliased.backendLabels.wdl-call-alias": "my_task_aliased" | ||
"calls.I_hope_nobody_names_workflows_like_this_as_it_seems_very_unnecessary_.my_task_aliased.labels.wdl-task-name": "MY_TASK" | ||
"calls.I_hope_nobody_names_workflows_like_this_as_it_seems_very_unnecessary_.my_task_aliased.labels.wdl-call-alias": "my_task_aliased" | ||
"labels.cromwell-workflow-id": "cromwell-<<UUID>>" | ||
} |
5 changes: 5 additions & 0 deletions
5
centaur/src/main/resources/standardTestCases/google_labels/gcpbatch_bad_options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"google_labels": { | ||
"custom-label-label-label-label-label-label-label-label-label-label": "Custom-Value!!!" | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
centaur/src/main/resources/standardTestCases/google_labels/gcpbatch_google_labels.wdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
version 1.0 | ||
|
||
workflow google_labels { | ||
|
||
meta { | ||
description: "Confirms that the google_labels workflow option is propagated correctly to tasks" | ||
} | ||
|
||
input { | ||
Array[Pair[String, String]] expected_kvps = [ ("wdl-task-name", "check_labels") ] | ||
Boolean check_aliases = true | ||
} | ||
|
||
# Build an array of checker lines to confirm the existence of each KVP: | ||
scatter (p in expected_kvps) { | ||
String checker_lines = "echo $INSTANCE_INFO | grep -q '\"~{p.left}\": \"~{p.right}\"' || echo \"Couldn't find correct '~{p.left}' label in instance info: $INSTANCE_INFO\" 1>&2" | ||
} | ||
|
||
call check_labels { input: label_checker_lines = checker_lines } | ||
|
||
if (check_aliases) { | ||
call check_labels as check_label_alias { input: label_checker_lines = [ | ||
"echo $INSTANCE_INFO | grep -q '\"wdl-task-name\": \"check_labels\"' || echo \"Couldn't find correct 'wdl-task-name' label in instance info: $INSTANCE_INFO\" 1>&2", | ||
"echo $INSTANCE_INFO | grep -q '\"wdl-call-alias\": \"check_label_alias\"' || echo \"Couldn't find correct 'wdl-call-alias' label in instance info: $INSTANCE_INFO\" 1>&2" | ||
] } | ||
} | ||
|
||
output { | ||
Boolean done = true | ||
} | ||
|
||
} | ||
|
||
task check_labels { | ||
|
||
input { | ||
Array[String] label_checker_lines | ||
} | ||
|
||
command { | ||
# Check that the task metadata is correct: | ||
INSTANCE=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/name" -H "Metadata-Flavor: Google") | ||
TOKEN=$(gcloud auth application-default print-access-token) | ||
INSTANCE_INFO=$(curl -s "https://www.googleapis.com/compute/v1/projects/broad-dsde-cromwell-dev/zones/us-central1-c/instances/$INSTANCE" \ | ||
-H "Authorization: Bearer $TOKEN" \ | ||
-H 'Accept: application/json') | ||
|
||
# Check for the custom label in the instance info: | ||
~{sep="\n" label_checker_lines} | ||
} | ||
runtime { | ||
docker: "gcr.io/google.com/cloudsdktool/cloud-sdk:slim" | ||
# Specify this zone because it's used in the curl commands above. We probably *could* work this out ad-hoc but it's easier to hard-code it here: | ||
zones: ["us-central1-c"] | ||
failOnStderr: true | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
centaur/src/main/resources/standardTestCases/google_labels/gcpbatch_wrapper.wdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version 1.0 | ||
|
||
import "google_labels.wdl" | ||
|
||
workflow google_labels_wrapper { | ||
call google_labels.google_labels { input: | ||
expected_kvps = [ ("cromwell-sub-workflow-name", "google_labels"), ("wdl-task-name", "check_labels") ], | ||
check_aliases = false | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
centaur/src/main/resources/standardTestCases/google_labels_bad.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
centaur/src/main/resources/standardTestCases/google_labels_good.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
centaur/src/main/resources/standardTestCases/google_labels_subworkflows.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters