[ARVADOS] updated: 82f2fc3b04aaa31a254e6f97da7bb2befb5cad83

Git user git at public.curoverse.com
Sun Apr 24 18:08:06 EDT 2016


Summary of changes:
 sdk/cwl/tests/matcher.py     | 23 +++++++++++++++++++++++
 sdk/cwl/tests/test_submit.py | 25 ++++++++++++++++++-------
 2 files changed, 41 insertions(+), 7 deletions(-)
 create mode 100644 sdk/cwl/tests/matcher.py

  discards  9c7b05def00a04c560e408eab65d3554a59fff94 (commit)
       via  82f2fc3b04aaa31a254e6f97da7bb2befb5cad83 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (9c7b05def00a04c560e408eab65d3554a59fff94)
            \
             N -- N -- N (82f2fc3b04aaa31a254e6f97da7bb2befb5cad83)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 82f2fc3b04aaa31a254e6f97da7bb2befb5cad83
Author: Tom Clegg <tom at curoverse.com>
Date:   Sun Apr 24 16:06:37 2016 -0400

    8653: Add test cases for input types.

diff --git a/sdk/cwl/tests/matcher.py b/sdk/cwl/tests/matcher.py
new file mode 100644
index 0000000..d3c9316
--- /dev/null
+++ b/sdk/cwl/tests/matcher.py
@@ -0,0 +1,23 @@
+import difflib
+import json
+
+
+class JsonDiffMatcher(object):
+    """Raise AssertionError with a readable JSON diff when not __eq__().
+
+    Used with assert_called_with() so it's possible for a human to see
+    the differences between expected and actual call arguments that
+    include non-trivial data structures.
+    """
+    def __init__(self, expected):
+        self.expected = expected
+
+    def __eq__(self, actual):
+        expected_json = json.dumps(self.expected, sort_keys=True, indent=2)
+        actual_json = json.dumps(actual, sort_keys=True, indent=2)
+        if expected_json != actual_json:
+            raise AssertionError("".join(difflib.context_diff(
+                expected_json.splitlines(1),
+                actual_json.splitlines(1),
+                fromfile="Expected", tofile="Actual")))
+        return True
diff --git a/sdk/cwl/tests/order/empty_order.json b/sdk/cwl/tests/order/empty_order.json
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/sdk/cwl/tests/order/empty_order.json
@@ -0,0 +1 @@
+{}
diff --git a/sdk/cwl/tests/order/inputs_test_order.json b/sdk/cwl/tests/order/inputs_test_order.json
new file mode 100644
index 0000000..6eda14e
--- /dev/null
+++ b/sdk/cwl/tests/order/inputs_test_order.json
@@ -0,0 +1,9 @@
+{
+    "#fileInput": {
+        "class": "File",
+        "path": "../input/blorp.txt"
+    },
+    "#boolInput": true,
+    "#floatInput": 1.234,
+    "#optionalFloatInput": null
+}
diff --git a/sdk/cwl/tests/test_submit.py b/sdk/cwl/tests/test_submit.py
index 750eeae..3a5c38f 100644
--- a/sdk/cwl/tests/test_submit.py
+++ b/sdk/cwl/tests/test_submit.py
@@ -11,6 +11,8 @@ import mock
 import sys
 import unittest
 
+from .matcher import JsonDiffMatcher
+
 
 def stubs(func):
     @functools.wraps(func)
@@ -124,7 +126,7 @@ class TestSubmit(unittest.TestCase):
 
 class TestCreateTemplate(unittest.TestCase):
     @stubs
-    def test_create_pipeline_template(self, stubs):
+    def test_create(self, stubs):
         project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz'
 
         capture_stdout = cStringIO.StringIO()
@@ -152,3 +154,88 @@ class TestCreateTemplate(unittest.TestCase):
 
         self.assertEqual(capture_stdout.getvalue(),
                          json.dumps(stubs.expect_pipeline_template_uuid))
+
+    @stubs
+    def test_inputs_empty(self, stubs):
+        exited = arvados_cwl.main(
+            ["--create-template", "--no-wait",
+             "tests/wf/inputs_test.cwl", "tests/order/empty_order.json"],
+            cStringIO.StringIO(), sys.stderr, api_client=stubs.api)
+        self.assertEqual(exited, 0)
+
+        expect_template = {
+            "owner_uuid": stubs.fake_user_uuid,
+            "components": {
+                "inputs_test.cwl": {
+                    'runtime_constraints': {
+                        'docker_image': 'arvados/jobs',
+                    },
+                    'script_parameters': {
+                        'cwl:tool':
+                        '99999999999999999999999999999991+99/'
+                        'wf/inputs_test.cwl',
+                        '#optionalFloatInput': None,
+                        '#fileInput': {
+                            'dataclass': 'File',
+                            'required': True,
+                        },
+                        '#floatInput': {
+                            'dataclass': 'number',
+                            'required': True,
+                        },
+                        '#optionalFloatInput': {
+                            'dataclass': 'number',
+                            'required': False,
+                        },
+                        '#boolInput': {
+                            'dataclass': 'Boolean',
+                            'required': True,
+                        },
+                    },
+                    'repository': 'arvados',
+                    'script_version': 'master',
+                    'script': 'cwl-runner',
+                },
+            },
+            "name": "inputs_test.cwl",
+        }
+        stubs.api.pipeline_templates().create.assert_called_with(
+            body=JsonDiffMatcher(expect_template))
+
+    @stubs
+    def test_inputs(self, stubs):
+        exited = arvados_cwl.main(
+            ["--create-template", "--no-wait",
+             "tests/wf/inputs_test.cwl", "tests/order/inputs_test_order.json"],
+            cStringIO.StringIO(), sys.stderr, api_client=stubs.api)
+        self.assertEqual(exited, 0)
+
+        expect_template = {
+            "owner_uuid": stubs.fake_user_uuid,
+            "components": {
+                "inputs_test.cwl": {
+                    'runtime_constraints': {
+                        'docker_image': 'arvados/jobs',
+                    },
+                    'script_parameters': {
+                        'cwl:tool':
+                        '99999999999999999999999999999991+99/'
+                        'wf/inputs_test.cwl',
+                        '#optionalFloatInput': None,
+                        '#fileInput': {
+                            'path':
+                            '99999999999999999999999999999992+99/blorp.txt',
+                            'class': 'File',
+                        },
+                        '#floatInput': 1.234,
+                        '#boolInput': True,
+                    },
+                    'repository': 'arvados',
+                    'script_version': 'master',
+                    'script': 'cwl-runner',
+                },
+            },
+            "name": "inputs_test.cwl",
+        }
+        stubs.api.pipeline_templates().create.assert_called_with(
+            body=JsonDiffMatcher(expect_template))
diff --git a/sdk/cwl/tests/wf/inputs_test.cwl b/sdk/cwl/tests/wf/inputs_test.cwl
new file mode 100644
index 0000000..03d924c
--- /dev/null
+++ b/sdk/cwl/tests/wf/inputs_test.cwl
@@ -0,0 +1,22 @@
+# Test case for arvados-cwl-runner. Used to test propagation of
+# various input types as script_parameters in pipeline templates.
+
+class: Workflow
+inputs:
+  - id: "#fileInput"
+    type: File
+    description: |
+      It's a file; we expect to find some characters in it.
+  - id: "#boolInput"
+    type: boolean
+  - id: "#floatInput"
+    type: float
+  - id: "#optionalFloatInput"
+    type: ["null", float]
+outputs: []
+steps:
+  - id: step1
+    inputs:
+      - { id: x, source: "#x" }
+    outputs: []
+    run: ../tool/submit_tool.cwl

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list