diff --git a/.gitignore b/.gitignore index 61aa6cfe90448c1155227324a785c1dd12b78e7c..81269344b70363c7dded62ba102e23cdc4d528dd 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,5 @@ /runtime bootstrap.json .cache -.coverage +/.coverage* coverage.xml diff --git a/raml/examples/gear_full.json b/raml/examples/gear_full.json index b4ecf54279d2b2fe143f88b40c40a629ff2fc9f2..908f0ad588ab6ea4d09aee16064fff0cd98fe1af 100755 --- a/raml/examples/gear_full.json +++ b/raml/examples/gear_full.json @@ -1,16 +1,37 @@ { - "name": "dcm_convert", + "name": "test-case-gear", "manifest": { - "config": {}, + "name": "test-case-gear", + "label": "Test Case Gear", + "version": "0", + + "author": "Nathaniel Kofalt", + "description": "A gear built to drive test cases", + + "url": "http://none.example", + "source": "http://none.example", + "license": "MIT", + + "config": { + "two-digit multiple of ten": { + "exclusiveMaximum": true, + "type": "number", + "multipleOf": 10, + "maximum": 100 + } + }, + "inputs": { - "dicom": { + "any text file <= 100 KB": { "base": "file", - "type": { - "enum": [ - "dicom" - ] + "name": { + "pattern": "^.*.txt$" + }, + "size": { + "maximum": 100000 } } } - } -} \ No newline at end of file + }, + "input": {} +} diff --git a/raml/examples/input/job-new.json b/raml/examples/input/job-new.json index d7424237e92016c0a53b7cdd2bcdf08f76ab9510..551aef42af11704ad07a97258602644ef0a66252 100755 --- a/raml/examples/input/job-new.json +++ b/raml/examples/input/job-new.json @@ -1,17 +1,20 @@ { - "gear": "dcm_convert", - "inputs": { - "dicom": { - "type": "acquisition", - "id": "573c9e6a844eac7fc01747cd", - "name" : "1_1_dicom.zip" - } - }, - "destination": { - "type": "acquisition", - "id": "573c9e6a844eac7fc01747cd" - }, - "tags": [ - "ad-hoc" - ] + "gear": "test-case-gear", + "inputs": { + "dicom": { + "type": "acquisition", + "id": "573c9e6a844eac7fc01747cd", + "name" : "1_1_dicom.zip" + } + }, + "config": { + "two-digit multiple of ten": 20 + }, + "destination": { + "type": "acquisition", + "id": "573c9e6a844eac7fc01747cd" + }, + "tags": [ + "ad-hoc" + ] } diff --git a/test/integration_tests/abao/abao_test_hooks.js b/test/integration_tests/abao/abao_test_hooks.js index 9a86da5dbfbbee7904239a898868718481655bb8..995471e66be8ac720780c3bddbe94c65754b7d86 100644 --- a/test/integration_tests/abao/abao_test_hooks.js +++ b/test/integration_tests/abao/abao_test_hooks.js @@ -2,7 +2,7 @@ var hooks = require('hooks'); // Variables for passing results as input to subsequent tests var job_id = ''; -var gear_name = ''; +var gear_name = 'test-case-gear'; var group_id = 'test_group'; // Tests we're skipping, fix these @@ -140,14 +140,14 @@ hooks.before("GET /gears/{GearName} -> 200", function(test, done) { hooks.before("POST /gears/{GearName} -> 200", function(test, done) { test.request.params = { - GearName: "dcm_convert" + GearName: gear_name }; done(); }); hooks.before("GET /gears/{GearName} -> 200", function(test, done) { test.request.params = { - GearName: "dcm_convert" + GearName: gear_name }; done(); }); diff --git a/test/integration_tests/postman/integration_tests.postman_collection b/test/integration_tests/postman/integration_tests.postman_collection index a5e441e369f8ea08cd3811811aaf3c7a05fe8dc7..a98bc4b52dd3e502bf2d306d57adb6f516a2172e 100644 --- a/test/integration_tests/postman/integration_tests.postman_collection +++ b/test/integration_tests/postman/integration_tests.postman_collection @@ -2,7 +2,7 @@ "variables": [], "info": { "name": "test", - "_postman_id": "90e24cfd-f35f-ae05-7248-c066527bf096", + "_postman_id": "fc8f9020-aa70-327d-4e99-9c8a98db1009", "description": "", "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" }, @@ -118,35 +118,6 @@ }, "response": [] }, - { - "name": "Add dcm-convert gear", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\ntests[\"Response time is less than 200ms\"] = responseTime < 200;" - } - } - ], - "request": { - "url": "{{baseUri}}/gears/dcm-convert?root=true", - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "scitran-user {{test_user_api_key}}", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\": \"dcm-convert\",\n\t\"manifest\": {\n\t\t\"config\": {},\n\t\t\"inputs\": {\n\t\t\t\"dicom\": {\n\t\t\t\t\"base\": \"file\",\n\t\t\t\t\"type\": {\n\t\t\t\t\t\"enum\": [\n\t\t\t\t\t\t\"dicom\"\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"input\": {}\n}" - }, - "description": "" - }, - "response": [] - }, { "name": "Create test-group", "event": [ @@ -297,7 +268,8 @@ "key": "file", "src": "test/integration_tests/postman/test_files/test-1.dcm", "type": "file", - "enabled": true + "enabled": true, + "value": "" } ] }, @@ -306,19 +278,19 @@ "response": [] }, { - "name": "Add job", + "name": "Submit invalid gear", "event": [ { "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\ntests[\"Response time is less than 200ms\"] = responseTime < 200;" + "exec": "tests[\"Status code is 400\"] = responseCode.code === 400;" } } ], "request": { - "url": "{{baseUri}}/jobs/add", - "method": "POST", + "url": "{{baseUri}}/gears/test_gear?root=true", + "method": "post", "header": [ { "key": "Authorization", @@ -328,26 +300,26 @@ ], "body": { "mode": "raw", - "raw": "{\n \"gear\": \"dcm-convert\",\n \"inputs\": {\n \"dicom\": {\n \"type\": \"acquisition\",\n \"id\": \"{{test-acquisition-id}}\",\n \"name\" : \"1_1_dicom.zip\"\n }\n },\n \"destination\": {\n \"type\": \"acquisition\",\n \"id\": \"{{test-acquisition-id}}\"\n },\n \"tags\": [\n \"ad-hoc\"\n ]\n}\n" + "raw": "{\n\t\"category\": \"converter\",\n\t\"input\": { },\n\t\"name\": \"test_gear\",\n\t\"manifest\": {\n\t\t\"name\": \"test_gear\",\n\t\t\"inputs\": {\n\t\t\t\"any text file <= 100 KB\": {\n\t\t\t\t\"base\": \"file\",\n\t\t\t\t\"name\": {\n\t\t\t\t\t\"pattern\": \"^.*.txt$\"\n\t\t\t\t},\n\t\t\t\t\"size\": {\n\t\t\t\t\t\"maximum\": 100000\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"description\": \"A gear to test the API\",\n\t\t\"license\": \"Other\",\n\t\t\"author\": \"\",\n\t\t\"url\": \"https://unknown.example\",\n\t\t\"label\": \"An exported gear\",\n\t\t\"source\": \"https://unknown.example\",\n\t\t\"config\": {\n\t\t\t\"two-digit multiple of ten\": {\n\t\t\t\t\"exclusiveMaximum\": true,\n\t\t\t\t\"type\": \"number\",\n\t\t\t\t\"multipleOf\": 10,\n\t\t\t\t\"maximum\": 100\n\t\t\t}\n\t\t}\n\t}\n}" }, - "description": "" + "description": "Create or update a gear.\n\"Name\" field of gear must match \"GearName\" uri parameter\nIf no existing gear is found, one will be created\nOtherwise, the specified gear will be updated\n\n\nParameters:\n\nGearName: Name of the gear to interact with\n\n" }, "response": [] }, { - "name": "Submit invalid gear", + "name": "Add test-case-gear gear", "event": [ { "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 400\"] = responseCode.code === 400;" + "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\ntests[\"Response time is less than 200ms\"] = responseTime < 200;" } } ], "request": { - "url": "{{baseUri}}/gears/test_gear?root=true", - "method": "post", + "url": "{{baseUri}}/gears/test-case-gear?root=true", + "method": "POST", "header": [ { "key": "Authorization", @@ -357,26 +329,26 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"category\": \"converter\",\n\t\"input\": { },\n\t\"name\": \"test_gear\",\n\t\"manifest\": {\n\t\t\"name\": \"test_gear\",\n\t\t\"inputs\": {\n\t\t\t\"any text file <= 100 KB\": {\n\t\t\t\t\"base\": \"file\",\n\t\t\t\t\"name\": {\n\t\t\t\t\t\"pattern\": \"^.*.txt$\"\n\t\t\t\t},\n\t\t\t\t\"size\": {\n\t\t\t\t\t\"maximum\": 100000\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"description\": \"A gear to test the API\",\n\t\t\"license\": \"Other\",\n\t\t\"author\": \"\",\n\t\t\"url\": \"https://unknown.example\",\n\t\t\"label\": \"An exported gear\",\n\t\t\"source\": \"https://unknown.example\",\n\t\t\"config\": {\n\t\t\t\"two-digit multiple of ten\": {\n\t\t\t\t\"exclusiveMaximum\": true,\n\t\t\t\t\"type\": \"number\",\n\t\t\t\t\"multipleOf\": 10,\n\t\t\t\t\"maximum\": 100\n\t\t\t}\n\t\t}\n\t}\n}" + "raw": "{\n\t\"name\": \"test-case-gear\",\n\t\"manifest\": {\n\t\t\"name\": \"test-case-gear\",\n\t\t\"label\": \"Test Case Gear\",\n\t\t\"version\": \"0\",\n\t\t\n\t\t\"author\": \"Nathaniel Kofalt\",\n\t\t\"description\": \"A gear built to drive test cases\",\n\t\t\n\t\t\"url\": \"http://none.example\",\n\t\t\"source\": \"http://none.example\",\n\t\t\"license\": \"MIT\",\n\t\t\n\t\t\"config\": {\n\t\t\t\"two-digit multiple of ten\": {\n\t\t\t\t\"exclusiveMaximum\": true,\n\t\t\t\t\"type\": \"number\",\n\t\t\t\t\"multipleOf\": 10,\n\t\t\t\t\"maximum\": 100\n\t\t\t}\n\t\t},\n\t\t\n\t\t\"inputs\": {\n\t\t\t\"any text file <= 100 KB\": {\n\t\t\t\t\"base\": \"file\",\n\t\t\t\t\"name\": {\n\t\t\t\t\t\"pattern\": \"^.*.txt$\"\n\t\t\t\t},\n\t\t\t\t\"size\": {\n\t\t\t\t\t\"maximum\": 100000\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"input\": {}\n}" }, - "description": "Create or update a gear.\n\"Name\" field of gear must match \"GearName\" uri parameter\nIf no existing gear is found, one will be created\nOtherwise, the specified gear will be updated\n\n\nParameters:\n\nGearName: Name of the gear to interact with\n\n" + "description": "" }, "response": [] }, { - "name": "Submit valid gear", + "name": "Add job", "event": [ { "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;" + "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\ntests[\"Response time is less than 200ms\"] = responseTime < 200;" } } ], "request": { - "url": "{{baseUri}}/gears/test-gear?root=true", - "method": "post", + "url": "{{baseUri}}/jobs/add", + "method": "POST", "header": [ { "key": "Authorization", @@ -386,9 +358,9 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"category\": \"converter\",\n\t\"input\": { },\n\t\"name\": \"test-gear\",\n\t\"manifest\": {\n\t\t\"name\": \"test-gear\",\n\t\t\"inputs\": {\n\t\t\t\"any text file <= 100 KB\": {\n\t\t\t\t\"base\": \"file\",\n\t\t\t\t\"name\": {\n\t\t\t\t\t\"pattern\": \"^.*.txt$\"\n\t\t\t\t},\n\t\t\t\t\"size\": {\n\t\t\t\t\t\"maximum\": 100000\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"description\": \"A gear to test the API\",\n\t\t\"license\": \"Other\",\n\t\t\"author\": \"\",\n\t\t\"version\": \"0\",\n\t\t\"url\": \"https://unknown.example\",\n\t\t\"label\": \"An exported gear\",\n\t\t\"source\": \"https://unknown.example\",\n\t\t\"config\": {\n\t\t\t\"two-digit multiple of ten\": {\n\t\t\t\t\"exclusiveMaximum\": true,\n\t\t\t\t\"type\": \"number\",\n\t\t\t\t\"multipleOf\": 10,\n\t\t\t\t\"maximum\": 100\n\t\t\t}\n\t\t}\n\t}\n}" + "raw": "{\n \"gear\": \"test-case-gear\",\n \"inputs\": {\n \"dicom\": {\n \"type\": \"acquisition\",\n \"id\": \"{{test-acquisition-id}}\",\n \"name\" : \"1_1_dicom.zip\"\n }\n },\n \"config\": {\n\t\t\"two-digit multiple of ten\": 20\n\t},\n \"destination\": {\n \"type\": \"acquisition\",\n \"id\": \"{{test-acquisition-id}}\"\n },\n \"tags\": [\n \"ad-hoc\"\n ]\n}\n" }, - "description": "Create or update a gear.\n\"Name\" field of gear must match \"GearName\" uri parameter\nIf no existing gear is found, one will be created\nOtherwise, the specified gear will be updated\n\n\nParameters:\n\nGearName: Name of the gear to interact with\n\n" + "description": "" }, "response": [] }