Skip to content

Commit

Permalink
Extend a func test.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Dec 10, 2021
1 parent 51492d0 commit 4b3d4d3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/functional/graphql/02-root-queries.t
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ query {
job(id: \"${USER}${ID_DELIM}${WORKFLOW_NAME}${ID_DELIM}20190101T00${ID_DELIM}foo${ID_DELIM}1\") {
id
}
jobs(workflows: [\"*${ID_DELIM}*\"], ids: [\"*${ID_DELIM}*${ID_DELIM}1\"], sort: {keys: [\"id\"], reverse: false}) {
jobs(workflows: [\"*${ID_DELIM}*\"], ids: [\"*${ID_DELIM}*${ID_DELIM}1\"], submit_time, sort: {keys: [\"id\"], reverse: false}) {
id
}
task(id: \"${USER}${ID_DELIM}${WORKFLOW_NAME}${ID_DELIM}foo\") {
Expand Down
24 changes: 21 additions & 3 deletions tests/functional/graphql/03-is-held-arg.t
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ query {
workflows {
name
isHeldTotal
taskProxies(isHeld: false) {
taskProxies(isHeld: true) {
id
jobs {
submittedTime
startedTime
}
}
familyProxies(exids: [\"root\"], isHeld: true) {
id
Expand All @@ -69,14 +73,28 @@ run_ok "${TEST_NAME_BASE}-contact" cylc get-contact "${WORKFLOW_NAME}"
# stop workflow
cylc stop --max-polls=10 --interval=2 --kill "${WORKFLOW_NAME}"

RESPONSE="${TEST_NAME_BASE}-is-held-arg.stdout"
perl -pi -e 's/("submittedTime":).*$/${1} "blargh",/' "${RESPONSE}"
perl -pi -e 's/("startedTime":).*$/${1} "blargh"/' "${RESPONSE}"

# compare to expectation
cmp_json "${TEST_NAME}-out" "${TEST_NAME_BASE}-is-held-arg.stdout" << __HERE__
cmp_json "${TEST_NAME}-out" "$RESPONSE" << __HERE__
{
"workflows": [
{
"name": "${WORKFLOW_NAME}",
"isHeldTotal": 1,
"taskProxies": [],
"taskProxies": [
{
"id": "${USER}${ID_DELIM}${WORKFLOW_NAME}${ID_DELIM}1${ID_DELIM}foo",
"jobs": [
{
"submittedTime": "blargh",
"startedTime": "blargh"
}
]
}
],
"familyProxies": [
{
"id": "${USER}${ID_DELIM}${WORKFLOW_NAME}${ID_DELIM}1${ID_DELIM}BAZ"
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/lib/python/diffr.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,17 @@ def load_json(file1, file2=None):
"""
try:
this = json.loads(file1)
except json.decoder.JSONDecodeError:
sys.exit('Syntax error in file1')
except json.decoder.JSONDecodeError as exc:
sys.exit(f'Syntax error in file1: {exc}')
raise

try:
if file2:
that = json.loads(file2)
else:
that = json.load(sys.stdin)
except json.decoder.JSONDecodeError:
sys.exit('Syntax error in file2')
except json.decoder.JSONDecodeError as exc:
sys.exit(f'Syntax error in file2: {exc}')
raise

return this, that
Expand Down

0 comments on commit 4b3d4d3

Please sign in to comment.