scitran / core

RESTful API
https://scitran.github.io
MIT License
18 stars 18 forks source link

Integration tests fail with Mongo 3.6 #1037

Closed ehlertjd closed 6 years ago

ehlertjd commented 6 years ago

Steps to reproduce:

  1. Change the MONGO_VERSION variable in tests/bin/run-tests-docker.sh to 3.6
  2. Run integration tests

Expected results:

Actual results:

Test Failure:

__________________________________________________________________________________________________ test_collections __________________________________________________________________________________________________

data_builder = <conftest.DataBuilder object at 0x7f5382d3f4d0>, as_admin = <conftest.BaseUrlSession object at 0x7f5382d58210>, as_user = <conftest.BaseUrlSession object at 0x7f538282a050>

    def test_collections(data_builder, as_admin, as_user):
        session = data_builder.create_session()
        acquisition = data_builder.create_acquisition()

        # create collection
        r = as_admin.post('/collections', json={
            'label': 'SciTran/Testing'
        })
        assert r.ok
        collection = r.json()['_id']

        # get all collections w/ stats=true
        r = as_admin.get('/collections', params={'stats': 'true'})
>       assert r.ok
E       assert <Response [500]>.ok

tests/integration_tests/python/test_collection.py:14: AssertionError

Relevant Log snippet:

2017-12-13 22:42:37      scitran.api                  base.py    51:INFO Initialized request request_id=1b094d4c-1513204957
2017-12-13 22:42:37      scitran.api                  base.py   375:ERRO Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "./api/handlers/collectionshandler.py", line 119, in get_all
    result = containerutil.get_stats(result, 'collections')
  File "./api/dao/containerutil.py", line 120, in get_stats
    result = config.db.command('aggregate', 'sessions', pipeline=pipeline).get('result', [])
  File "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line 481, in command
    codec_options, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line 393, in _command
    allowable_errors)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/pool.py", line 211, in command
    read_concern)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/network.py", line 100, in command
    helpers._check_command_response(response_doc, msg, allowable_errors)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", line 196, in _check_command_response
    raise OperationFailure(msg % errmsg, code, response)
OperationFailure: command SON([('aggregate', 'sessions'), ('pipeline', [{'$match': {'_id': {'$in': []}}}, {'$project': {'non_compliant': {'$cond': [{'$eq': ['$satisfies_template', False]}, 1, 0]}, '_id': 1}}, {'$group': {'total': {'$sum': 1}, '_id': 1, 'noncompliant_count': {'$sum': '$non_compliant'}}}])]) on namespace scitran.$cmd failed: The 'cursor' option is required, except for aggregate with the explain argument
 request_id=1b094d4c-1513204957
127.0.0.1 - - [13/Dec/2017:22:42:37 +0000] "GET /api/collections?stats=true HTTP/1.1" 500 630 "-" "python-requests/2.18.4" request_id=1b094d4c-1513204957