Skip to content
Snippets Groups Projects
Commit e79936f8 authored by Justin Ehlert's avatar Justin Ehlert
Browse files

Refactor JSON Schemas and remove ABAO

parent 68a07fb0
No related branches found
No related tags found
No related merge requests found
Showing
with 54 additions and 152 deletions
......@@ -13,7 +13,6 @@ All tests are executed by default. Subsets can be run using the filtering option
* To run linting, use `--lint` (`-l`)
* To run unit tests, use `--unit` (`-u`)
* To run integration tests, use `--integ` (`-i`)
* To run abao tests, use `--abao` (`-a`)
* To pass any arguments to `py.test`, use `-- PYTEST_ARGS`
See [py.test usage](https://docs.pytest.org/en/latest/usage.html) for more.
......@@ -34,11 +33,3 @@ Without rebuilding the image, run only integration tests matching `foo`, use the
```
**NOTE:** The mongodb version is pinned via the `MONGO_VERSION` variable in `tests/bin/run-tests-docker.sh`.
### Tools
- [abao](https://github.com/cybertk/abao/)
### Testing API against RAML with Abao
Abao is one of the testing tools run during our TravisCI build. It tests the API implementation against what’s defined in the RAML spec. Adding a new resource / url to the RAML spec will cause Abao to verify that resource during integration tests. Sometimes abao cannot properly test a resource (file field uploads) or a test may require chaining variable. Abao has before and after hooks for tests, written in javascript. These can be used to skip a test, inject variables into the request, or make extra assertions about the response. See tests/integration/abao in the repo for the hooks file. See [abao github readme](https://github.com/cybertk/abao/blob/master/README.md) for more information on how to use hooks.
Abao tests can depend on specific resources (eg. group, project, session, etc.) pre-existing in the DB. That resource loading should be maintained within `tests/integration_tests/abao/load_fixture.py` and is executed automatically via the integration test scripts at `test/bin`.
......@@ -157,7 +157,6 @@ expected_input_schemas = set([
'avatars.json',
'collection.json',
'collection-update.json',
'container.json',
'device.json',
'file.json',
'file-update.json',
......@@ -182,8 +181,7 @@ expected_input_schemas = set([
'enginemetadata.json',
'labelupload.json',
'uidupload.json',
'uidmatchupload.json',
'search.json'
'uidmatchupload.json'
])
mongo_schemas = set()
input_schemas = set()
......
{
"label": "example-acquisition-new-label"
}
{
"label": "example-acquisition",
"session": "57e45328466d8e000e33a85b",
"public": false
}
{
"analysis": {
"label": "Test Analysis 1"
},
"job" : {
"gear": "dcm_convert",
"inputs": {
"dicom": {
"type": "acquisition",
"id": "57081d06b386a6dc79ca386b",
"name" : "test_acquisition_dicom.zip"
}
},
"tags": ["example"]
}
}
......@@ -43,5 +43,5 @@
"description": "This is an analysis description",
"job": "54759eb3c090d83494e2d804",
"label": "Analysis label",
"user": "user_1"
}
\ No newline at end of file
"user": "canakgun@flywheel.io"
}
{
"contents": {
"operation": "add",
"nodes": [{
"level": "session",
"_id": "57dc50b0931cefd8ac2a371e"
}]
}
}
{"label":"control-group","description":"Control group collection"}
{
"info": {
"basic": "info"
},
"errors": [
"An Error"
],
"interval": 400
}
{
"label": "Example Group",
"_id": "example_group"
}
{
"label":"New group label"
}
{
"text":"Scitran core!"
}
{
"_id":"coltonlw@flywheel.io",
"access":"admin"
}
{
"value":"example-tag"
}
{
"_id": "jane.doe@gmail.com",
"firstname": "Jane",
"lastname": "Doe",
"email": "jane.doe@gmail.com",
"root": false
}
{
"firstname": "Jane",
"lastname": "Smith",
"email": "jane.smith@gmail.com"
}
[
{
"inputs": [
{
"input": "dicom",
"type": "acquisition",
"id": "57d75ec38e4eb9699b3c245e",
"name": "1_1_dicom.zip"
}
],
"inputs": {
"dicom": {
"type": "acquisition",
"id": "57d75ec38e4eb9699b3c245e",
"name": "1_1_dicom.zip"
}
},
"attempt": 1,
"gear_id": "dcm-convert",
"tags": [
......@@ -20,20 +19,19 @@
"modified": "2016-08-11T12:46:12.593000+00:00",
"created": "2016-08-11T12:46:12.593000+00:00",
"state": "pending",
"_id": "57ac7394c700190017123fb8",
"id": "57ac7394c700190017123fb8",
"config":{
"speed":3
}
},
{
"inputs": [
{
"input":"dicom",
"inputs": {
"dicom": {
"type": "acquisition",
"id": "57ac7394c700190017123fb7",
"name": "8403_4_1_t1_dicom.zip"
}
],
},
"attempt": 1,
"gear_id": "dcm_convert",
"tags": [
......@@ -47,7 +45,7 @@
"modified": "2016-08-11T13:02:09.055000+00:00",
"created": "2016-08-11T13:02:09.055000+00:00",
"state": "pending",
"_id": "57ac77515e325c0018cd17cf",
"id": "57ac77515e325c0018cd17cf",
"config":{
"speed":3
}
......
{
"inputs": [{
"input": "dicom",
"type": "acquisition",
"id": "57e45279a74e91000ed6898f",
"name": "4784_1_1_localizer_dicom.zip"
}],
"attempt": 1,
"gear_id": "dicom-mr-classifier",
"tags": ["dicom-mr-classifier"],
"destination": {
"type": "acquisition",
"id": "57e45279a74e91000ed6898f"
},
"request": {
"inputs": [{
"vu": "vu0:sha384:tXvdI2pspng-YH6lwa2UcLsww0yR6LfEKbLm89eIqEGicLRHW9d1V8bs7gXHTlZ3",
"type": "http",
"location": "/",
"uri": "https://storage.googleapis.com/flywheel/gears/v1/scitran/dicom-mr-classifier/dicom-mr-classifier_latest_20160803T220847.856417Z.tar.gz"
}, {
"type": "scitran",
"uri": "/acquisitions/57e45279a74e91000ed6898f/files/4784_1_1_localizer_dicom.zip",
"location": "/flywheel/v0/input/dicom"
}],
"target": {
"command": ["bash", "-c", "rm -rf output; mkdir -p output; ./run; echo \"Exit was $?\""],
"env": {
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
},
"dir": "/flywheel/v0"
},
"outputs": [{
"type": "scitran",
"uri": "/engine?level=acquisition&id=57e45279a74e91000ed6898f&job=57e45279a74e91000ed68991",
"location": "/flywheel/v0/output"
}]
},
"modified": "2016-09-28T16:11:36.260000+00:00",
"created": "2016-09-22T21:51:53.174000+00:00",
"state": "running",
"_id": "57e45279a74e91000ed68991",
"config": null
}
......@@ -2,11 +2,10 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions":{
"acquisition-input":{
"x-gen-name": "acquisition",
"type": "object",
"properties": {
"public": {"$ref":"container.json#/definitions/public"},
"label": {"$ref":"container.json#/definitions/label"},
"label": {"$ref":"common.json#/definitions/label"},
"info": {"$ref":"container.json#/definitions/info"},
"session": {"$ref":"common.json#/definitions/objectid"},
"uid": {"$ref":"container.json#/definitions/uid"},
......@@ -15,13 +14,32 @@
},
"additionalProperties":false
},
"acquisition-metadata-input": {
"type": "object",
"x-note": "Are all of these fields still used/valid? Can this be reconciled with enginemetadata.json#/definitions/uid-upload-input?",
"properties": {
"public": {"type": ["boolean", "null"]},
"label": {"type": ["string", "null"]},
"info": {"type": ["object", "null"]},
"metadata": {"type": ["object", "null"]},
"measurement": {"type": ["string", "null"]},
"instrument": {"type": ["string", "null"]},
"uid": {"type": ["string", "null"]},
"timestamp": {"$ref":"container.json#/definitions/timestamp"},
"timezone": {"type": ["string", "null"]},
"files": {
"type": ["array", "null"],
"items": {"$ref": "file.json#/definitions/file-input"}
}
},
"additionalProperties": false
},
"acquisition-output":{
"x-gen-name": "acquisition",
"type":"object",
"properties": {
"_id": {"$ref":"common.json#/definitions/objectid"},
"public": {"$ref":"container.json#/definitions/public"},
"label": {"$ref":"container.json#/definitions/label"},
"label": {"$ref":"common.json#/definitions/label"},
"info": {"$ref":"container.json#/definitions/info"},
"session": {"$ref":"common.json#/definitions/objectid"},
"uid": {"$ref":"container.json#/definitions/uid"},
......
......@@ -9,17 +9,16 @@
"type": ["array", "null"],
"items": {"$ref":"file.json#/definitions/file"}
},
"user": {"type": "string"},
"analysis-input":{
"type":"object",
"properties":{
"inputs": {"$ref":"#/definitions/inputs"},
"outputs": {"$ref":"#/definitions/outputs"},
"notes": {"$ref":"note.json#/definitions/notes-list-output"},
"description": {"type":"string"},
"description": {"$ref":"common.json#/definitions/description"},
"job": {"$ref":"common.json#/definitions/objectid"},
"label": {"$ref":"common.json#/definitions/label"},
"user": {"$ref":"#/definitions/user"}
"user": {"$ref":"common.json#/definitions/user-id"}
},
"additionalProperties": false
},
......@@ -45,13 +44,27 @@
]
},
"notes": {"$ref":"note.json#/definitions/notes-list-output"},
"description": {"type":"string"},
"description": {"$ref":"common.json#/definitions/description"},
"label": {"$ref":"common.json#/definitions/label"},
"user": {"$ref":"common.json#/definitions/user-id"},
"created": {"$ref":"created-modified.json#/definitions/created"},
"modified": {"$ref":"created-modified.json#/definitions/modified"}
},
"required":["_id", "files", "label", "user", "created", "modified"]
},
"analysis-job": {
"type": "object",
"properties":{
"analysis":{
"type":"object",
"allOf":[{"$ref":"#/definitions/analysis-input"}],
"required":["label"]
}
},
"job":{
"type":"object",
"allOf":[{"$ref":"job.json#/definitions/job-input"}]
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment